Skip to content

Use different layer-shell anchors on Wayland

Since we can't get the workarea geometry on Wayland, we can't know the actual usable width and height of the monitor. If we're just doing initial top-left placement, this only becomes a problem in two places:

  1. when we have enough notifications to fill a column on the screen, and
  2. when we fill up the entire screen to the last column.

There isn't really anything we can do about the first problem right now. Well, and we can't do anything about the second problem either. But, if we always use TOP and LEFT layer-shell anchors, but the initial notification positioning is set to something other than top-left, then even the first notification shown can be displayed partly off-screen. For example, with TOP and LEFT anchors, and top-right positioning, if there's a vertical panel on the left side of the screen, we'll calculate the position of the first notification such that it will extend a little bit off the right side of the screen, because we'll set the left margin without knowing that the panel is there.

If we use anchors that correspond to the initial positioning set for notifications, at least we can ensure that the x-coord positioning will be correct for all but the last column of notifications (which should be rare; hopefully people don't often have a screen completely full of notifications).

We still cannot fix the issue where the y-coord can be wrong and push notifications partially off-screen. For that, we'll need an compositor protocol that tells us at least the workarea size, if not the position.

There is also another issue: due to a GTK3 bug[0], if the compositor has set a non-integer scale for the monitor, we will not be able to know the full usable area of the monitor. Unfortunately there's not much I can do about this (as the GTK maintainers aren't interested in merging a fix for this bug) until we have a stable release of libxfce4windowing and I can use XfwMonitor.

Jefferson González also contributed some Wayland positioning fixes to this commit.

Fixes #132 (closed).

[0] https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/7383

Edited by Brian Tarricone

Merge request reports