diff --git a/.local/bin/setbg b/.local/bin/setbg index cd91326..b40f800 100755 --- a/.local/bin/setbg +++ b/.local/bin/setbg @@ -13,8 +13,9 @@ # if $1 is a jpg file, set it as a wallpaper # if $1 is a directory, choose a randomized image in it, set it as wallpaper -[ -f "$1" ] && cp $1 "$XDG_CONFIG_HOME/wall.jpg" && dunstify -u "low" "Wallpaper changed" +wall="$XDG_STATE_HOME/wall.jpg" +[ -f "$1" ] && cp $1 "$wall" && dunstify -u "low" "Wallpaper changed" -[ -d "$1" ] && cp "$(find "$1"/*.jpg -type f | shuf -n 1)" "$XDG_CONFIG_HOME/wall.jpg" && dunstify -u "low" "Random wallpaper chosen" +[ -d "$1" ] && cp "$(find "$1"/*.jpg -type f | shuf -n 1)" "$" && dunstify -u "low" "Random wallpaper chosen" -xwallpaper --zoom "$XDG_CONFIG_HOME/wall.jpg" +xwallpaper --zoom "$wall" diff --git a/.local/bin/statusbar/sb-battery b/.local/bin/statusbar/sb-battery index cd07a56..82a5f32 100755 --- a/.local/bin/statusbar/sb-battery +++ b/.local/bin/statusbar/sb-battery @@ -15,16 +15,17 @@ # In any case, show the remaining battery percentage # Also sends a notification if battery running low +time="$XDG_STATE_HOME/batteryupdate" notify() { \ now=$(date +%s) - if [ -e $XDG_CONFIG_HOME/batteryupdate ]; then - old=$(cat $XDG_CONFIG_HOME/batteryupdate) + if [ -e $time ]; then + old=$(cat $time) delta=$(expr $now - $old) else delta=$now fi [ 300 -gt $delta ] && return; - echo $now > $XDG_CONFIG_HOME/batteryupdate + echo $now > $time case "$capacity" in 2[0-9]) notify-send -u "normal" "Battery is running low ($capacity%)" "Please plug your computer to a power source" ;; *) notify-send -u "critical" "Battery is dangerously low ($capacity%)" "Please plug your computer to a power source - NOW!" ;; diff --git a/.zshenv b/.zshenv index ab9145e..ba8353c 100644 --- a/.zshenv +++ b/.zshenv @@ -4,6 +4,7 @@ export XDG_CACHE_HOME="$HOME/.cache" export XDG_CONFIG_HOME="$HOME/.config" export XDG_DATA_HOME="$HOME/.local/share" +export XDG_STATE_HOME="$HOME/.local/state" export ZDOTDIR="$HOME/.config/zsh"