@@ -29,6 +29,7 @@ public class Gala.ShellClientsManager : Object, GestureTarget {
2929
3030 private GLib . HashTable<Meta . Window , PanelWindow > panel_windows = new GLib .HashTable<Meta . Window , PanelWindow > (null , null );
3131 private GLib . HashTable<Meta . Window , ShellWindow > positioned_windows = new GLib .HashTable<Meta . Window , ShellWindow > (null , null );
32+ private GLib . HashTable<Meta . Window , MonitorLabelWindow > monitor_label_windows = new GLib .HashTable<Meta . Window , MonitorLabelWindow > (null , null );
3233
3334 private ShellClientsManager (WindowManager wm ) {
3435 Object (wm: wm);
@@ -240,6 +241,18 @@ public class Gala.ShellClientsManager : Object, GestureTarget {
240241 window. unmanaging. connect_after ((_window) = > positioned_windows. remove (_window));
241242 }
242243
244+ public void make_monitor_label (Meta .Window window , int monitor_index ) requires (!is_itself_positioned (window )) {
245+ if (monitor_index < 0 || monitor_index > wm. get_display (). get_n_monitors ()) {
246+ warning (" Invalid monitor index provided: %d " , monitor_index);
247+ return ;
248+ }
249+
250+ monitor_label_windows[window] = new MonitorLabelWindow (window, monitor_index);
251+
252+ // connect_after so we make sure that any queued move is unqueued
253+ window. unmanaging. connect_after ((_window) = > monitor_label_windows. remove (_window));
254+ }
255+
243256 public void propagate (UpdateType update_type , GestureAction action , double progress ) {
244257 foreach (var window in positioned_windows. get_values ()) {
245258 window. propagate (update_type, action, progress);
@@ -251,7 +264,8 @@ public class Gala.ShellClientsManager : Object, GestureTarget {
251264 }
252265
253266 public bool is_itself_positioned (Meta .Window window ) {
254- return (window in positioned_windows) || (window in panel_windows) || NotificationStack . is_notification (window);
267+ return (window in positioned_windows) || (window in panel_windows) ||
268+ (window in monitor_label_windows) || NotificationStack . is_notification (window);
255269 }
256270
257271 public bool is_positioned_window (Meta .Window window ) {
@@ -350,6 +364,15 @@ public class Gala.ShellClientsManager : Object, GestureTarget {
350364 set_restore_previous_x11_region (window);
351365 break ;
352366
367+ case " monitor-label" :
368+ int parsed;
369+ if (int . try_parse (val, out parsed)) {
370+ make_monitor_label (window, parsed);
371+ } else {
372+ warning (" Failed to parse %s as monitor label" , val);
373+ }
374+ break ;
375+
353376 default:
354377 break ;
355378 }
0 commit comments