Skip to content

Commit 2dd1c97

Browse files
dereifiedclefebvre
andauthored
Allow stickies to be created under Wayland. (#146)
Wayland doesn't support default monitors. Also X11 users may choose not to have a default monitor (not sure why they would). This manifests in Wayland users not being able to create new stickies at all. For now choose monitor 0 for the display. There are probably better approaches (eg find monitor of manager window), but they are more complex. This clears the bug. Co-authored-by: Clement Lefebvre <clement.lefebvre@linuxmint.com>
1 parent bbef9ca commit 2dd1c97

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

usr/lib/sticky/sticky.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,9 +1004,13 @@ def find_note_location(self, x, y, direction):
10041004
return x, y
10051005

10061006
def get_direction(self, parent=None):
1007-
workarea_rect = Gdk.Monitor.get_workarea(
1008-
Gdk.Display.get_primary_monitor(Gdk.Display.get_default())
1009-
)
1007+
monitor = Gdk.Display.get_primary_monitor(Gdk.Display.get_default())
1008+
if monitor == None:
1009+
# if user has no monitor configured, or uses Wayland, for now guess
1010+
# monitor 0 (better than a crash)
1011+
monitor = Gdk.Display.get_monitor(Gdk.Display.get_default(),0)
1012+
1013+
workarea_rect = Gdk.Monitor.get_workarea(monitor)
10101014
direction = [1, 1]
10111015
if parent:
10121016
if parent.x > (workarea_rect.width / 2):

0 commit comments

Comments
 (0)