tv xmonad shell: prevent double yield

This commit is contained in:
tv 2018-12-03 22:48:11 +01:00
parent 63798eb150
commit e8e0a68029

View File

@ -46,7 +46,7 @@ in
xmonad_restart() {( xmonad_restart() {(
set -efu set -efu
cd "$WORKDIR" cd "$WORKDIR"
if systemctl is-active xmonad; then if systemctl --quiet is-active xmonad; then
sudo systemctl stop xmonad sudo systemctl stop xmonad
cp -b "$config_XMONAD_CACHE_DIR"/xmonad.state "$CACHEDIR"/ cp -b "$config_XMONAD_CACHE_DIR"/xmonad.state "$CACHEDIR"/
echo "xmonad.state: $(cat "$CACHEDIR"/xmonad.state)" echo "xmonad.state: $(cat "$CACHEDIR"/xmonad.state)"
@ -59,9 +59,14 @@ in
xmonad_yield() {( xmonad_yield() {(
set -efu set -efu
"$xmonad" --shutdown if ! systemctl --quiet is-active xmonad; then
cp -b "$CACHEDIR"/xmonad.state "$config_XMONAD_CACHE_DIR"/ "$xmonad" --shutdown
sudo systemctl start xmonad 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 export PATH=${config.systemd.services.xmonad.path}:$PATH