Skip to content

Commit 6871bb1

Browse files
authored
Merge branch 'main' into main
2 parents 63308fb + 046e895 commit 6871bb1

File tree

7 files changed

+58
-7
lines changed

7 files changed

+58
-7
lines changed

build-scripts/swaync-git.rpkg.spec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Summary: Notification daemon with GTK GUI
88
Provides: desktop-notification-daemon
99
Provides: sway-notification-center = %{version}-%{release}
1010
Provides: %{alt_pkg_name} = %{version}-%{release}
11+
Provides: %{alt_pkg_name}-git = %{version}-%{release}
1112
License: GPLv3
1213
URL: https://github.com/ErikReider/SwayNotificationCenter
1314
VCS: {{{ git_repo_vcs }}}

src/config.json.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"layer": "overlay",
66
"control-center-layer": "top",
77
"layer-shell": true,
8+
"layer-shell-cover-screen": true,
89
"cssPriority": "application",
910
"control-center-margin-top": 0,
1011
"control-center-margin-bottom": 0,

src/configModel/configModel.vala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,12 @@ namespace SwayNotificationCenter {
338338
*/
339339
public bool layer_shell { get; set; default = true; }
340340

341+
/**
342+
* Wether or not the windows should cover the whole screen when
343+
* layer-shell is used.
344+
*/
345+
public bool layer_shell_cover_screen { get; set; default = true; }
346+
341347
/** The CSS loading priority */
342348
public CssPriority cssPriority { // vala-lint=naming-convention
343349
get; set; default = CssPriority.APPLICATION;

src/configSchema.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
"description": "Wether or not the windows should be opened as layer-shell surfaces. Note: Requires swaync restart to apply",
2626
"default": true
2727
},
28+
"layer-shell-cover-screen": {
29+
"type": "boolean",
30+
"description": "Wether or not the windows should cover the whole screen when layer-shell is used. Fixes animations in compositors like Hyprland.",
31+
"default": true
32+
},
2833
"cssPriority": {
2934
"type": "string",
3035
"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",

src/controlCenter/controlCenter.vala

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,11 @@ namespace SwayNotificationCenter {
394394

395395
/** Resets the UI positions */
396396
private void set_anchor () {
397+
PositionX pos_x = ConfigModel.instance.control_center_positionX;
398+
if (pos_x == PositionX.NONE) pos_x = ConfigModel.instance.positionX;
399+
PositionY pos_y = ConfigModel.instance.control_center_positionY;
400+
if (pos_y == PositionY.NONE) pos_y = ConfigModel.instance.positionY;
401+
397402
if (swaync_daemon.use_layer_shell) {
398403
// Set the exlusive zone
399404
int exclusive_zone = ConfigModel.instance.control_center_exclusive_zone ? 0 : 100;
@@ -423,6 +428,41 @@ namespace SwayNotificationCenter {
423428
break;
424429
}
425430
GtkLayerShell.set_layer (this, layer);
431+
432+
// Set whether the control center should cover the whole screen or not
433+
bool cover_screen = ConfigModel.instance.layer_shell_cover_screen;
434+
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.TOP, cover_screen);
435+
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.LEFT, cover_screen);
436+
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.RIGHT, cover_screen);
437+
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.BOTTOM, cover_screen);
438+
if (!ConfigModel.instance.layer_shell_cover_screen) {
439+
switch (pos_x) {
440+
case PositionX.LEFT:
441+
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.LEFT, true);
442+
break;
443+
case PositionX.CENTER:
444+
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.LEFT, true);
445+
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.RIGHT, true);
446+
break;
447+
default:
448+
case PositionX.RIGHT:
449+
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.RIGHT, true);
450+
break;
451+
}
452+
switch (pos_y) {
453+
default:
454+
case PositionY.TOP:
455+
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.TOP, true);
456+
break;
457+
case PositionY.CENTER:
458+
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.TOP, true);
459+
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.BOTTOM, true);
460+
break;
461+
case PositionY.BOTTOM:
462+
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.BOTTOM, true);
463+
break;
464+
}
465+
}
426466
}
427467

428468
// Set the box margins
@@ -433,8 +473,6 @@ namespace SwayNotificationCenter {
433473

434474
// Anchor box to north/south edges as needed
435475
Gtk.Align align_x = Gtk.Align.END;
436-
PositionX pos_x = ConfigModel.instance.control_center_positionX;
437-
if (pos_x == PositionX.NONE) pos_x = ConfigModel.instance.positionX;
438476
switch (pos_x) {
439477
case PositionX.LEFT:
440478
align_x = Gtk.Align.START;
@@ -448,8 +486,6 @@ namespace SwayNotificationCenter {
448486
break;
449487
}
450488
Gtk.Align align_y = Gtk.Align.START;
451-
PositionY pos_y = ConfigModel.instance.control_center_positionY;
452-
if (pos_y == PositionY.NONE) pos_y = ConfigModel.instance.positionY;
453489
switch (pos_y) {
454490
default:
455491
case PositionY.TOP:

src/functions.vala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,8 @@ namespace SwayNotificationCenter {
357357
spawn_env += additions;
358358
}
359359

360-
string[] argvp = {};
361-
Shell.parse_argv (cmd, out argvp);
360+
string[] argvp;
361+
Shell.parse_argv ("/bin/sh -c %s".printf (cmd), out argvp);
362362

363363
Pid child_pid;
364364
int std_output;

src/swayncDaemon/swayncDaemon.vala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@ namespace SwayNotificationCenter {
129129

130130
[DBus (visible = false)]
131131
public void show_blank_windows (Gdk.Monitor ? monitor) {
132-
if (!use_layer_shell) return;
132+
if (!use_layer_shell || !ConfigModel.instance.layer_shell_cover_screen) {
133+
return;
134+
}
133135
foreach (unowned BlankWindow win in blank_windows.data) {
134136
if (win.monitor != monitor) win.show ();
135137
}

0 commit comments

Comments
 (0)