summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorMichael Weiss <dev.primeos@gmail.com>2019-01-04 11:49:07 +0100
committerGitHub <noreply@github.com>2019-01-04 11:49:07 +0100
commit65c953976c4261865a23ae6f7c8855f878116419 (patch)
treefd9115fb8dc216e6b6cceec02508ffbaaad78e99 /nixos
parentb27b443e145863b5b7f502d8beccb6767572f3c3 (diff)
parentd15425f81653e13cae44c259932c10bf34b6708e (diff)
downloadnixpkgs-65c953976c4261865a23ae6f7c8855f878116419.tar
nixpkgs-65c953976c4261865a23ae6f7c8855f878116419.tar.gz
nixpkgs-65c953976c4261865a23ae6f7c8855f878116419.tar.bz2
nixpkgs-65c953976c4261865a23ae6f7c8855f878116419.tar.lz
nixpkgs-65c953976c4261865a23ae6f7c8855f878116419.tar.xz
nixpkgs-65c953976c4261865a23ae6f7c8855f878116419.tar.zst
nixpkgs-65c953976c4261865a23ae6f7c8855f878116419.zip
Merge pull request #53138 from gnidorah/sway
nixos/sway: Improve the wrapper
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/programs/sway.nix13
1 files changed, 10 insertions, 3 deletions
diff --git a/nixos/modules/programs/sway.nix b/nixos/modules/programs/sway.nix
index 0eaaf6b85b9..b3847db8cd9 100644
--- a/nixos/modules/programs/sway.nix
+++ b/nixos/modules/programs/sway.nix
@@ -7,11 +7,18 @@ let
   swayPackage = pkgs.sway;
 
   swayWrapped = pkgs.writeShellScriptBin "sway" ''
-    if [[ "$#" -ge 1 ]]; then
+    set -o errexit
+
+    if [ ! "$_SWAY_WRAPPER_ALREADY_EXECUTED" ]; then
+      export _SWAY_WRAPPER_ALREADY_EXECUTED=1
+      ${cfg.extraSessionCommands}
+    fi
+
+    if [ "$DBUS_SESSION_BUS_ADDRESS" ]; then
+      export DBUS_SESSION_BUS_ADDRESS
       exec sway-setcap "$@"
     else
-      ${cfg.extraSessionCommands}
-      exec ${pkgs.dbus.dbus-launch} --exit-with-session sway-setcap
+      exec ${pkgs.dbus}/bin/dbus-run-session sway-setcap "$@"
     fi
   '';
   swayJoined = pkgs.symlinkJoin {