summaryrefslogtreecommitdiffstats
path: root/tv
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2018-12-04 08:08:43 +0100
committerlassulus <lassulus@lassul.us>2018-12-04 08:08:43 +0100
commit329abcefa2d6bc33f6fe55268f4019f65de1cd7e (patch)
treea5724be8669d0f1bd44910cddc2899eb72f1e8ab /tv
parent006364274f516eb41def5f711c23b19e0b0a41f8 (diff)
parent740340ae840eb13012d6c08dfe0f924b58eec5e3 (diff)
Merge remote-tracking branch 'ni/master'
Diffstat (limited to 'tv')
-rw-r--r--tv/5pkgs/haskell/xmonad-tv/shell.nix13
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 936e696..6ca00bc 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