xmonad-tv: startupHook = $XMONAD_STARTUP_HOOK &

This commit is contained in:
tv 2016-05-25 01:37:52 +02:00
parent 9172da3aa0
commit 73a6331225
2 changed files with 13 additions and 26 deletions

View File

@ -56,8 +56,8 @@ let
requires = [ "xserver.service" ]; requires = [ "xserver.service" ];
environment = xmonad-environment; environment = xmonad-environment;
serviceConfig = { serviceConfig = {
ExecStart = "${xmonad-start}/bin/xmonad"; ExecStart = "${pkgs.xmonad-tv}/bin/xmonad-tv";
ExecStop = "${xmonad-stop}/bin/xmonad-stop"; ExecStop = "${pkgs.xmonad-tv}/bin/xmonad-tv --shutdown";
User = user.name; User = user.name;
WorkingDirectory = user.home; WorkingDirectory = user.home;
}; };
@ -80,6 +80,14 @@ let
xmonad-environment = { xmonad-environment = {
DISPLAY = ":${toString config.services.xserver.display}"; DISPLAY = ":${toString config.services.xserver.display}";
XMONAD_STARTUP_HOOK = pkgs.writeDash "xmonad-startup-hook" ''
${pkgs.xorg.xhost}/bin/xhost +LOCAL: &
${pkgs.xorg.xrdb}/bin/xrdb -merge ${import ./Xresources.nix args} &
${pkgs.xorg.xsetroot}/bin/xsetroot -solid '#1c1c1c' &
wait
'';
XMONAD_STATE = "/tmp/xmonad.state"; XMONAD_STATE = "/tmp/xmonad.state";
# XXX JSON is close enough :) # XXX JSON is close enough :)
@ -96,29 +104,6 @@ let
]); ]);
}; };
xmonad-start = pkgs.writeScriptBin "xmonad" ''
#! ${pkgs.bash}/bin/bash
set -efu
settle() {(
# Use PATH for a clean journal
command=''${1##*/}
PATH=''${1%/*}; export PATH
shift
until "$command" "$@"; do
${pkgs.coreutils}/bin/sleep 1
done
)&}
settle ${pkgs.xorg.xhost}/bin/xhost +LOCAL:
settle ${pkgs.xorg.xrdb}/bin/xrdb -merge ${import ./Xresources.nix args}
settle ${pkgs.xorg.xsetroot}/bin/xsetroot -solid '#1c1c1c'
exec ${pkgs.xmonad-tv}/bin/xmonad-tv
'';
xmonad-stop = pkgs.writeScriptBin "xmonad-stop" ''
#! /bin/sh
exec ${pkgs.xmonad-tv}/bin/xmonad-tv --shutdown
'';
xserver-environment = { xserver-environment = {
XKB_BINDIR = "${pkgs.xorg.xkbcomp}/bin"; # Needed for the Xkb extension. XKB_BINDIR = "${pkgs.xorg.xkbcomp}/bin"; # Needed for the Xkb extension.
XORG_DRI_DRIVER_PATH = "/run/opengl-driver/lib/dri"; # !!! Depends on the driver selected at runtime. XORG_DRI_DRIVER_PATH = "/run/opengl-driver/lib/dri"; # !!! Depends on the driver selected at runtime.

View File

@ -83,7 +83,9 @@ mainNoArgs = do
-- , handleEventHook = myHandleEventHooks <+> handleTimerEvent -- , handleEventHook = myHandleEventHooks <+> handleTimerEvent
--, handleEventHook = handleTimerEvent --, handleEventHook = handleTimerEvent
, manageHook = placeHook (smart (1,0)) <+> floatNextHook , manageHook = placeHook (smart (1,0)) <+> floatNextHook
, startupHook = liftIO (putStrLn "emit XMonadStartup") , startupHook = do
path <- liftIO (getEnv "XMONAD_STARTUP_HOOK")
forkFile path [] Nothing
, normalBorderColor = "#1c1c1c" , normalBorderColor = "#1c1c1c"
, focusedBorderColor = "#f000b0" , focusedBorderColor = "#f000b0"
, handleEventHook = handleShutdownEvent , handleEventHook = handleShutdownEvent