diff options
author | tv <tv@krebsco.de> | 2018-12-03 22:48:11 +0100 |
---|---|---|
committer | tv <tv@krebsco.de> | 2018-12-03 22:48:11 +0100 |
commit | e8e0a68029516b3577aef5aabf818589009f334d (patch) | |
tree | 96aa56cc869105f0b2dbda484c2ce7bccbbc1171 /tv | |
parent | 63798eb150e5d572ad887b2e6e6ce287fb187a48 (diff) |
tv xmonad shell: prevent double yield
Diffstat (limited to 'tv')
-rw-r--r-- | tv/5pkgs/haskell/xmonad-tv/shell.nix | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/tv/5pkgs/haskell/xmonad-tv/shell.nix b/tv/5pkgs/haskell/xmonad-tv/shell.nix index 936e69627..6ca00bc05 100644 --- a/tv/5pkgs/haskell/xmonad-tv/shell.nix +++ b/tv/5pkgs/haskell/xmonad-tv/shell.nix @@ -46,7 +46,7 @@ in xmonad_restart() {( set -efu cd "$WORKDIR" - if systemctl is-active xmonad; then + if systemctl --quiet is-active xmonad; then sudo systemctl stop xmonad cp -b "$config_XMONAD_CACHE_DIR"/xmonad.state "$CACHEDIR"/ echo "xmonad.state: $(cat "$CACHEDIR"/xmonad.state)" @@ -59,9 +59,14 @@ in xmonad_yield() {( set -efu - "$xmonad" --shutdown - cp -b "$CACHEDIR"/xmonad.state "$config_XMONAD_CACHE_DIR"/ - sudo systemctl start xmonad + if ! systemctl --quiet is-active xmonad; then + "$xmonad" --shutdown + cp -b "$CACHEDIR"/xmonad.state "$config_XMONAD_CACHE_DIR"/ + sudo systemctl start xmonad + else + echo "xmonad.service is already running" >&2 + exit -1 + fi )} export PATH=${config.systemd.services.xmonad.path}:$PATH |