From b7b55e285cfc92e84f243012516bbc414691b747 Mon Sep 17 00:00:00 2001 From: novenary Date: Thu, 7 Mar 2024 17:48:31 +0200 Subject: [PATCH] sway: stop sway-session.target on exit This ensures graphical-session.target is properly cycled, and that all of its members are restarted on consecutive runs. --- modules/services/window-managers/i3-sway/sway.nix | 6 +++++- .../window-managers/sway/sway-bar-focused-colors.conf | 2 +- .../sway/sway-bindkeys-to-code-and-extra-config.conf | 2 +- .../modules/services/window-managers/sway/sway-default.conf | 2 +- .../window-managers/sway/sway-followmouse-expected.conf | 2 +- .../sway/sway-followmouse-legacy-expected.conf | 2 +- .../modules/services/window-managers/sway/sway-modules.conf | 2 +- .../services/window-managers/sway/sway-null-package.conf | 2 +- .../services/window-managers/sway/sway-post-2003.conf | 2 +- .../window-managers/sway/sway-systemd-variables.conf | 2 +- .../sway/sway-workspace-default-expected.conf | 2 +- .../sway/sway-workspace-output-expected.conf | 2 +- 12 files changed, 16 insertions(+), 12 deletions(-) diff --git a/modules/services/window-managers/i3-sway/sway.nix b/modules/services/window-managers/i3-sway/sway.nix index cd1b27feb..c2fca3667 100644 --- a/modules/services/window-managers/i3-sway/sway.nix +++ b/modules/services/window-managers/i3-sway/sway.nix @@ -411,7 +411,11 @@ in { extraCommands = mkOption { type = types.listOf types.str; - default = [ "systemctl --user start sway-session.target" ]; + default = [ + "systemctl --user start sway-session.target" + "swaymsg -mt subscribe '[]' || true" + "systemctl --user stop sway-session.target" + ]; description = '' Extra commands to run after D-Bus activation. ''; diff --git a/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf b/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf index 448c41f47..841bdca9c 100644 --- a/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf +++ b/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf @@ -108,4 +108,4 @@ bar { } } -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.conf b/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.conf index d11f6f2bc..b6bf95952 100644 --- a/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.conf +++ b/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.conf @@ -107,5 +107,5 @@ bar { } } -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" exec_always pkill flashfocus; flasfocus & diff --git a/tests/modules/services/window-managers/sway/sway-default.conf b/tests/modules/services/window-managers/sway/sway-default.conf index 71a0b13fb..a37e91608 100644 --- a/tests/modules/services/window-managers/sway/sway-default.conf +++ b/tests/modules/services/window-managers/sway/sway-default.conf @@ -105,4 +105,4 @@ bar { } } -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-followmouse-expected.conf b/tests/modules/services/window-managers/sway/sway-followmouse-expected.conf index af259face..5345f8f87 100644 --- a/tests/modules/services/window-managers/sway/sway-followmouse-expected.conf +++ b/tests/modules/services/window-managers/sway/sway-followmouse-expected.conf @@ -83,4 +83,4 @@ mode "resize" { bindsym l resize grow width 10 px } -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-followmouse-legacy-expected.conf b/tests/modules/services/window-managers/sway/sway-followmouse-legacy-expected.conf index 1fd0003fc..590dc8aae 100644 --- a/tests/modules/services/window-managers/sway/sway-followmouse-legacy-expected.conf +++ b/tests/modules/services/window-managers/sway/sway-followmouse-legacy-expected.conf @@ -83,4 +83,4 @@ mode "resize" { bindsym l resize grow width 10 px } -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-modules.conf b/tests/modules/services/window-managers/sway/sway-modules.conf index 766d61de7..d11691e34 100644 --- a/tests/modules/services/window-managers/sway/sway-modules.conf +++ b/tests/modules/services/window-managers/sway/sway-modules.conf @@ -117,4 +117,4 @@ bar { } } -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-null-package.conf b/tests/modules/services/window-managers/sway/sway-null-package.conf index 67073371f..2066fcd27 100644 --- a/tests/modules/services/window-managers/sway/sway-null-package.conf +++ b/tests/modules/services/window-managers/sway/sway-null-package.conf @@ -105,4 +105,4 @@ bar { } } -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-post-2003.conf b/tests/modules/services/window-managers/sway/sway-post-2003.conf index 67073371f..2066fcd27 100644 --- a/tests/modules/services/window-managers/sway/sway-post-2003.conf +++ b/tests/modules/services/window-managers/sway/sway-post-2003.conf @@ -105,4 +105,4 @@ bar { } } -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-systemd-variables.conf b/tests/modules/services/window-managers/sway/sway-systemd-variables.conf index 1cbb92c32..2482ed450 100644 --- a/tests/modules/services/window-managers/sway/sway-systemd-variables.conf +++ b/tests/modules/services/window-managers/sway/sway-systemd-variables.conf @@ -105,4 +105,4 @@ bar { } } -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd XCURSOR_THEME XCURSOR_SIZE; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd XCURSOR_THEME XCURSOR_SIZE; systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf b/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf index 5233c0bb2..18dd31d26 100644 --- a/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf +++ b/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf @@ -104,4 +104,4 @@ bar { } } -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf b/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf index 32dfd7344..4fb7685c6 100644 --- a/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf +++ b/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf @@ -110,4 +110,4 @@ workspace "ABC" output "DP" workspace "3: Test" output "HDMI" workspace "!"§$%&/(){}[]=?\*#<>-_.:,;²³" output "DVI" workspace "Multiple" output "DVI" "HDMI" "DP" -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user start sway-session.target && swaymsg -mt subscribe '[]' || true && systemctl --user stop sway-session.target"