Skip to content

Commit

Permalink
Add positonY center for notifications and CC (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikReider committed May 14, 2023
1 parent b8ef618 commit a8b04b9
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/configModel/configModel.vala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace SwayNotificationCenter {
}

public enum PositionY {
TOP, BOTTOM, NONE;
TOP, BOTTOM, CENTER, NONE;
}

public enum ImageVisibility {
Expand Down
2 changes: 1 addition & 1 deletion src/configSchema.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"type": "string",
"description": "Vertical position of control center and notification window",
"default": "top",
"enum": ["top", "bottom"]
"enum": ["top", "center", "bottom"]
},
"control-center-positionX": {
"type": "string",
Expand Down
6 changes: 6 additions & 0 deletions src/controlCenter/controlCenter.vala
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,12 @@ namespace SwayNotificationCenter {
list_reverse = false;
list_align = Gtk.Align.START;
break;
case PositionY.CENTER:
align_y = Gtk.Align.CENTER;
// Set cc widget position
list_reverse = false;
list_align = Gtk.Align.START;
break;
case PositionY.BOTTOM:
align_y = Gtk.Align.END;
// Set cc widget position
Expand Down
21 changes: 14 additions & 7 deletions src/notificationWindow/notificationWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,6 @@ namespace SwayNotificationCenter {
break;
}
switch (ConfigModel.instance.positionY) {
case PositionY.BOTTOM:
GtkLayerShell.set_anchor (
this, GtkLayerShell.Edge.TOP, false);
GtkLayerShell.set_anchor (
this, GtkLayerShell.Edge.BOTTOM, true);
list_reverse = true;
break;
default:
case PositionY.TOP:
list_reverse = false;
Expand All @@ -102,6 +95,20 @@ namespace SwayNotificationCenter {
GtkLayerShell.set_anchor (
this, GtkLayerShell.Edge.TOP, true);
break;
case PositionY.CENTER:
list_reverse = false;
GtkLayerShell.set_anchor (
this, GtkLayerShell.Edge.BOTTOM, false);
GtkLayerShell.set_anchor (
this, GtkLayerShell.Edge.TOP, false);
break;
case PositionY.BOTTOM:
GtkLayerShell.set_anchor (
this, GtkLayerShell.Edge.TOP, false);
GtkLayerShell.set_anchor (
this, GtkLayerShell.Edge.BOTTOM, true);
list_reverse = true;
break;
}
}

Expand Down

0 comments on commit a8b04b9

Please sign in to comment.