Add positonY center for notifications and CC (#259)

This commit is contained in:
Erik Reider
2023-05-14 12:30:21 +02:00
committed by GitHub
parent b8ef618132
commit a8b04b9cf0
4 changed files with 22 additions and 9 deletions

View File

@@ -4,7 +4,7 @@ namespace SwayNotificationCenter {
}
public enum PositionY {
TOP, BOTTOM, NONE;
TOP, BOTTOM, CENTER, NONE;
}
public enum ImageVisibility {

View File

@@ -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",

View File

@@ -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

View File

@@ -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;
@@ -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;
}
}