@@ -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,19 @@ 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+ warning (" Made monitor label for monitor %d " , monitor_index);
251+ monitor_label_windows[window] = new MonitorLabelWindow (window, monitor_index);
252+
253+ // connect_after so we make sure that any queued move is unqueued
254+ window. unmanaging. connect_after ((_window) = > monitor_label_windows. remove (_window));
255+ }
256+
243257 public void propagate (UpdateType update_type , GestureAction action , double progress ) {
244258 foreach (var window in positioned_windows. get_values ()) {
245259 window. propagate (update_type, action, progress);
@@ -251,7 +265,8 @@ public class Gala.ShellClientsManager : Object, GestureTarget {
251265 }
252266
253267 public bool is_itself_positioned (Meta .Window window ) {
254- return (window in positioned_windows) || (window in panel_windows) || NotificationStack . is_notification (window);
268+ return (window in positioned_windows) || (window in panel_windows) ||
269+ (window in monitor_label_windows) || NotificationStack . is_notification (window);
255270 }
256271
257272 public bool is_positioned_window (Meta .Window window ) {
@@ -350,6 +365,15 @@ public class Gala.ShellClientsManager : Object, GestureTarget {
350365 set_restore_previous_x11_region (window);
351366 break ;
352367
368+ case " monitor-label" :
369+ int parsed;
370+ if (int . try_parse (val, out parsed)) {
371+ make_monitor_label (window, parsed);
372+ } else {
373+ warning (" Failed to parse %s as monitor label" , val);
374+ }
375+ break ;
376+
353377 default:
354378 break ;
355379 }
0 commit comments