Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the notification stack to be moved using DBus #1594

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/WindowManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,14 @@ namespace Gala {
*/
public abstract void perform_action (ActionType type);

/**
* Tells the window manager to move the Notifications Stack down
* by the given number of pixels, to make room for menus.
*
* @param offset The amount of pixels by which to move the notifications stack
*/
public abstract void offset_notifications (int32 offset);

/**
* Moves the window to the workspace next to its current workspace in the given direction.
* Gala currently only supports LEFT and RIGHT.
Expand Down
4 changes: 4 additions & 0 deletions src/DBus.vala
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ namespace Gala {
wm.perform_action (type);
}

public void offset_notifications (int32 offset) throws DBusError, Error {
wm.offset_notifications (offset);
}

private const double SATURATION_WEIGHT = 1.5;
private const double WEIGHT_THRESHOLD = 1.0;

Expand Down
7 changes: 6 additions & 1 deletion src/NotificationStack.vala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class Gala.NotificationStack : Object {

// we need to keep a small offset to the top, because we clip the container to
// its allocations and the close button would be off for the first notification
private const int TOP_OFFSET = 2;
lenemter marked this conversation as resolved.
Show resolved Hide resolved
private int TOP_OFFSET = 2;
private const int ADDITIONAL_MARGIN = 12;
private const int MARGIN = 12;

Expand Down Expand Up @@ -146,6 +146,11 @@ public class Gala.NotificationStack : Object {
}
}

public void offset_notifications (int32 offset) {
TOP_OFFSET = 2 + offset;
update_positions (true);
}

public void destroy_notification (Meta.WindowActor notification, bool animate) {
if (animate) {
notification.save_easing_state ();
Expand Down
4 changes: 4 additions & 0 deletions src/WindowManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,10 @@ namespace Gala {
}
}

public void offset_notifications (int32 offset) {
notification_stack.offset_notifications (offset);
}

public override void show_window_menu (Meta.Window window, Meta.WindowMenuType menu, int x, int y) {
switch (menu) {
case Meta.WindowMenuType.WM:
Expand Down