Skip to content

Commit 090cc4b

Browse files
authored
Set notification window type on X11 (#257)
1 parent a34d3c0 commit 090cc4b

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

src/AbstractBubble.vala

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ public class Notifications.AbstractBubble : Gtk.Window {
109109
// We have to wrap in Idle otherwise the Meta.Window of the WaylandSurface in Gala is still null
110110
Idle.add_once (init_wl);
111111
} else {
112-
init_x ();
112+
x11_make_notification ();
113+
x11_update_mutter_hints ();
113114
}
114115
});
115116

@@ -122,7 +123,7 @@ public class Notifications.AbstractBubble : Gtk.Window {
122123

123124
desktop_panel.add_blur (left, right, 16, 16, 9);
124125
} else if (Gdk.Display.get_default () is Gdk.X11.Display) {
125-
init_x ();
126+
x11_update_mutter_hints ();
126127
}
127128
});
128129

@@ -181,7 +182,7 @@ public class Notifications.AbstractBubble : Gtk.Window {
181182
right = (int) (16 - distance).clamp (0, width);
182183
}
183184

184-
private void init_x () {
185+
private void x11_update_mutter_hints () {
185186
var display = Gdk.Display.get_default ();
186187
if (display is Gdk.X11.Display) {
187188
unowned var xdisplay = ((Gdk.X11.Display) display).get_xdisplay ();
@@ -198,6 +199,23 @@ public class Notifications.AbstractBubble : Gtk.Window {
198199
}
199200
}
200201

202+
private void x11_make_notification () {
203+
unowned var display = Gdk.Display.get_default ();
204+
if (display is Gdk.X11.Display) {
205+
unowned var xdisplay = ((Gdk.X11.Display) display).get_xdisplay ();
206+
207+
var window = ((Gdk.X11.Surface) get_surface ()).get_xid ();
208+
209+
var atom = xdisplay.intern_atom ("_NET_WM_WINDOW_TYPE", false);
210+
var notification_atom = xdisplay.intern_atom ("_NET_WM_WINDOW_TYPE_NOTIFICATION", false);
211+
212+
// (X.Atom) 4 is XA_ATOM
213+
// 32 is format
214+
// 0 means replace
215+
xdisplay.change_property (window, atom, (X.Atom) 4, 32, 0, (uchar[]) notification_atom, 1);
216+
}
217+
}
218+
201219
private static Wl.RegistryListener registry_listener;
202220
private void init_wl () {
203221
registry_listener.global = registry_handle_global;

0 commit comments

Comments
 (0)