~ben/bin

65bd421fe18139392a719de52553b41fbeaf9afd — Ben Sima a year ago cb5ed74
xtheme: load state from ~/.local/share/xtheme
1 files changed, 18 insertions(+), 3 deletions(-)

M xtheme
M xtheme => xtheme +18 -3
@@ 7,10 7,24 @@ usage () {
    exit 1
}

export XTHEME="$1"
STATE=~/.local/share/xtheme

[ -z "$XTHEME" ] && usage
[ "$XTHEME" != "dark" ] && [ "$XTHEME" != "light" ] && usage
CUR_XTHEME=$(cat $STATE)
NEW_XTHEME="$1"

# check
[ -z "$NEW_XTHEME" ] && usage
[ "$NEW_XTHEME" != "dark" ] && [ "$NEW_XTHEME" != "light" ] && usage
if [ "$NEW_XTHEME" == "$CUR_XTHEME" ]
then
    echo "xtheme: already $NEW_XTHEME"
    exit 1
fi

# set new theme
echo "$NEW_XTHEME" > $STATE

## application hooks

# switch terminal theme
home-manager switch


@@ 25,6 39,7 @@ else
    --eval "(bs/switch-theme 'dark)" &
fi

# restart polybar
systemctl --user restart polybar &

wait