summaryrefslogtreecommitdiffstats
path: root/tv/2configs/xserver/default.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2019-02-08 18:02:29 +0100
committertv <tv@krebsco.de>2019-02-09 13:43:27 +0100
commit90b227622c6950845c24f62d03e2eb073005be6e (patch)
tree5946e3d56bb10c47c85b17febb61302c1434e996 /tv/2configs/xserver/default.nix
parent1b526ec1a597882b7629e992c7579ee109282aa7 (diff)
tv xmonad: add dbus
Diffstat (limited to 'tv/2configs/xserver/default.nix')
-rw-r--r--tv/2configs/xserver/default.nix19
1 files changed, 16 insertions, 3 deletions
diff --git a/tv/2configs/xserver/default.nix b/tv/2configs/xserver/default.nix
index f68e8e681..051e12ef0 100644
--- a/tv/2configs/xserver/default.nix
+++ b/tv/2configs/xserver/default.nix
@@ -48,10 +48,24 @@ in {
systemd.services.xmonad = let
xmonad = "${pkgs.haskellPackages.xmonad-tv}/bin/xmonad";
- xmonad-prepare = pkgs.writeDash "xmonad-prepare" ''
+ xmonad-start = pkgs.writeDash "xmonad-start" ''
${pkgs.coreutils}/bin/mkdir -p "$XMONAD_CACHE_DIR"
${pkgs.coreutils}/bin/mkdir -p "$XMONAD_CONFIG_DIR"
${pkgs.coreutils}/bin/mkdir -p "$XMONAD_DATA_DIR"
+
+ f=$HOME/.dbus/session-bus/$(${pkgs.coreutils}/bin/cat /etc/machine-id)-${
+ toString config.services.xserver.display
+ }
+ if test -e "$f" &&
+ . "$f" &&
+ ${pkgs.coreutils}/bin/kill -0 "$DBUS_SESSION_BUS_PID"
+ then
+ export DBUS_SESSION_BUS_ADDRESS
+ else
+ eval "$(${pkgs.dbus.lib}/bin/dbus-launch --sh-syntax)"
+ fi
+
+ exec ${xmonad}
'';
xmonad-ready = pkgs.writeDash "xmonad-ready" ''
{
@@ -97,8 +111,7 @@ in {
"/run/wrappers" # for su
];
serviceConfig = {
- ExecStartPre = "@${xmonad-prepare} xmonad-prepare";
- ExecStart = "@${xmonad} xmonad-${currentSystem}";
+ ExecStart = "@${xmonad-start} xmonad-${currentSystem}";
ExecStop = "@${xmonad} xmonad-${currentSystem} --shutdown";
SyslogIdentifier = "xmonad";
User = cfg.user.name;