Skip to content

Commit 0fb37cd

Browse files
committed
Make the notifications move out of the way when menus are opened
1 parent 98136fe commit 0fb37cd

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

src/Services/PopoverManager.vala

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,19 @@
1717
* Boston, MA 02110-1301 USA.
1818
*/
1919

20+
[DBus (name = "org.pantheon.gala")]
21+
public interface WMDBus : GLib.Object {
22+
public abstract void offset_notifications (int32 offset) throws DBusError, Error;
23+
}
24+
2025
public class Wingpanel.Services.PopoverManager : Object {
2126
private unowned Wingpanel.PanelWindow? owner;
2227

2328
private bool grabbed = false; // whether the wingpanel grabbed focus
2429
private bool mousing = false;
2530

31+
private WMDBus? wm = null;
32+
2633
private Gee.HashMap<string, Wingpanel.Widgets.IndicatorEntry> registered_indicators;
2734
private Wingpanel.Widgets.IndicatorPopover popover;
2835
private Wingpanel.Widgets.IndicatorEntry? _current_indicator = null;
@@ -59,10 +66,12 @@ public class Wingpanel.Services.PopoverManager : Object {
5966
owner.present ();
6067
popover.popup ();
6168
popover.show_all ();
69+
offset_notifications (popover);
6270
_current_indicator.base_indicator.opened ();
6371
} else {
6472
update_has_tooltip (((Wingpanel.Widgets.IndicatorEntry)popover.get_relative_to ()).display_widget);
6573
popover.popdown ();
74+
offset_notifications ();
6675
}
6776
}
6877
}
@@ -72,6 +81,12 @@ public class Wingpanel.Services.PopoverManager : Object {
7281

7382
this.owner = owner;
7483

84+
try {
85+
this.wm = Bus.get_proxy_sync (BusType.SESSION, "org.pantheon.gala", "/org/pantheon/gala");
86+
} catch (Error e) {
87+
warning ("Could not connect to dbus org.pantheon.gala");
88+
}
89+
7590
popover = new Wingpanel.Widgets.IndicatorPopover ();
7691

7792
popover.leave_notify_event.connect ((e) => {
@@ -238,4 +253,18 @@ public class Wingpanel.Services.PopoverManager : Object {
238253
}
239254
});
240255
}
256+
257+
private void offset_notifications(Wingpanel.Widgets.IndicatorPopover? popover = null) {
258+
int offset = 0;
259+
if (popover != null) {
260+
int minimum_height, natural_height;
261+
popover.get_preferred_height (out minimum_height, out natural_height);
262+
offset = natural_height;
263+
}
264+
try {
265+
wm.offset_notifications (offset);
266+
} catch (Error e) {
267+
warning ("Could not offset notifications: %s", e.message);
268+
}
269+
}
241270
}

0 commit comments

Comments
 (0)