Unverified Commit 86a7b5bd authored by Erik Reider's avatar Erik Reider Committed by GitHub

Added layer-shell-cover-screen option to fix animations in Hyprland (#520)

* Added layer-shell-cover-screen option to fix animations in Hyprland * Fixed linting issue
parent dc7cd1af
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
"layer": "overlay", "layer": "overlay",
"control-center-layer": "top", "control-center-layer": "top",
"layer-shell": true, "layer-shell": true,
"layer-shell-cover-screen": true,
"cssPriority": "application", "cssPriority": "application",
"control-center-margin-top": 0, "control-center-margin-top": 0,
"control-center-margin-bottom": 0, "control-center-margin-bottom": 0,
......
...@@ -335,6 +335,12 @@ namespace SwayNotificationCenter { ...@@ -335,6 +335,12 @@ namespace SwayNotificationCenter {
*/ */
public bool layer_shell { get; set; default = true; } public bool layer_shell { get; set; default = true; }
/**
* Wether or not the windows should cover the whole screen when
* layer-shell is used.
*/
public bool layer_shell_cover_screen { get; set; default = true; }
/** The CSS loading priority */ /** The CSS loading priority */
public CssPriority cssPriority { // vala-lint=naming-convention public CssPriority cssPriority { // vala-lint=naming-convention
get; set; default = CssPriority.APPLICATION; get; set; default = CssPriority.APPLICATION;
......
...@@ -25,6 +25,11 @@ ...@@ -25,6 +25,11 @@
"description": "Wether or not the windows should be opened as layer-shell surfaces. Note: Requires swaync restart to apply", "description": "Wether or not the windows should be opened as layer-shell surfaces. Note: Requires swaync restart to apply",
"default": true "default": true
}, },
"layer-shell-cover-screen": {
"type": "boolean",
"description": "Wether or not the windows should cover the whole screen when layer-shell is used. Fixes animations in compositors like Hyprland.",
"default": true
},
"cssPriority": { "cssPriority": {
"type": "string", "type": "string",
"description": "Which GTK priority to use when loading the default and user CSS files. Pick \"user\" to override XDG_CONFIG_HOME/gtk-3.0/gtk.css", "description": "Which GTK priority to use when loading the default and user CSS files. Pick \"user\" to override XDG_CONFIG_HOME/gtk-3.0/gtk.css",
......
...@@ -394,6 +394,11 @@ namespace SwayNotificationCenter { ...@@ -394,6 +394,11 @@ namespace SwayNotificationCenter {
/** Resets the UI positions */ /** Resets the UI positions */
private void set_anchor () { private void set_anchor () {
PositionX pos_x = ConfigModel.instance.control_center_positionX;
if (pos_x == PositionX.NONE) pos_x = ConfigModel.instance.positionX;
PositionY pos_y = ConfigModel.instance.control_center_positionY;
if (pos_y == PositionY.NONE) pos_y = ConfigModel.instance.positionY;
if (swaync_daemon.use_layer_shell) { if (swaync_daemon.use_layer_shell) {
// Set the exlusive zone // Set the exlusive zone
int exclusive_zone = ConfigModel.instance.control_center_exclusive_zone ? 0 : 100; int exclusive_zone = ConfigModel.instance.control_center_exclusive_zone ? 0 : 100;
...@@ -423,6 +428,41 @@ namespace SwayNotificationCenter { ...@@ -423,6 +428,41 @@ namespace SwayNotificationCenter {
break; break;
} }
GtkLayerShell.set_layer (this, layer); GtkLayerShell.set_layer (this, layer);
// Set whether the control center should cover the whole screen or not
bool cover_screen = ConfigModel.instance.layer_shell_cover_screen;
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.TOP, cover_screen);
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.LEFT, cover_screen);
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.RIGHT, cover_screen);
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.BOTTOM, cover_screen);
if (!ConfigModel.instance.layer_shell_cover_screen) {
switch (pos_x) {
case PositionX.LEFT:
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.LEFT, true);
break;
case PositionX.CENTER:
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.LEFT, true);
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.RIGHT, true);
break;
default:
case PositionX.RIGHT:
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.RIGHT, true);
break;
}
switch (pos_y) {
default:
case PositionY.TOP:
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.TOP, true);
break;
case PositionY.CENTER:
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.TOP, true);
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.BOTTOM, true);
break;
case PositionY.BOTTOM:
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.BOTTOM, true);
break;
}
}
} }
// Set the box margins // Set the box margins
...@@ -433,8 +473,6 @@ namespace SwayNotificationCenter { ...@@ -433,8 +473,6 @@ namespace SwayNotificationCenter {
// Anchor box to north/south edges as needed // Anchor box to north/south edges as needed
Gtk.Align align_x = Gtk.Align.END; Gtk.Align align_x = Gtk.Align.END;
PositionX pos_x = ConfigModel.instance.control_center_positionX;
if (pos_x == PositionX.NONE) pos_x = ConfigModel.instance.positionX;
switch (pos_x) { switch (pos_x) {
case PositionX.LEFT: case PositionX.LEFT:
align_x = Gtk.Align.START; align_x = Gtk.Align.START;
...@@ -448,8 +486,6 @@ namespace SwayNotificationCenter { ...@@ -448,8 +486,6 @@ namespace SwayNotificationCenter {
break; break;
} }
Gtk.Align align_y = Gtk.Align.START; Gtk.Align align_y = Gtk.Align.START;
PositionY pos_y = ConfigModel.instance.control_center_positionY;
if (pos_y == PositionY.NONE) pos_y = ConfigModel.instance.positionY;
switch (pos_y) { switch (pos_y) {
default: default:
case PositionY.TOP: case PositionY.TOP:
......
...@@ -129,7 +129,9 @@ namespace SwayNotificationCenter { ...@@ -129,7 +129,9 @@ namespace SwayNotificationCenter {
[DBus (visible = false)] [DBus (visible = false)]
public void show_blank_windows (Gdk.Monitor ? monitor) { public void show_blank_windows (Gdk.Monitor ? monitor) {
if (!use_layer_shell) return; if (!use_layer_shell || !ConfigModel.instance.layer_shell_cover_screen) {
return;
}
foreach (unowned BlankWindow win in blank_windows.data) { foreach (unowned BlankWindow win in blank_windows.data) {
if (win.monitor != monitor) win.show (); if (win.monitor != monitor) win.show ();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment