tv xmonad: add dbus

This commit is contained in:
tv 2019-02-08 18:02:29 +01:00
parent 1b526ec1a5
commit 90b227622c

View File

@ -48,10 +48,24 @@ in {
systemd.services.xmonad = let systemd.services.xmonad = let
xmonad = "${pkgs.haskellPackages.xmonad-tv}/bin/xmonad"; 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_CACHE_DIR"
${pkgs.coreutils}/bin/mkdir -p "$XMONAD_CONFIG_DIR" ${pkgs.coreutils}/bin/mkdir -p "$XMONAD_CONFIG_DIR"
${pkgs.coreutils}/bin/mkdir -p "$XMONAD_DATA_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" '' xmonad-ready = pkgs.writeDash "xmonad-ready" ''
{ {
@ -97,8 +111,7 @@ in {
"/run/wrappers" # for su "/run/wrappers" # for su
]; ];
serviceConfig = { serviceConfig = {
ExecStartPre = "@${xmonad-prepare} xmonad-prepare"; ExecStart = "@${xmonad-start} xmonad-${currentSystem}";
ExecStart = "@${xmonad} xmonad-${currentSystem}";
ExecStop = "@${xmonad} xmonad-${currentSystem} --shutdown"; ExecStop = "@${xmonad} xmonad-${currentSystem} --shutdown";
SyslogIdentifier = "xmonad"; SyslogIdentifier = "xmonad";
User = cfg.user.name; User = cfg.user.name;