feat: add $XDG_STATE_HOME directory
adapt sb-battery and setbg scripts
This commit is contained in:
parent
b03369ba79
commit
268c870d04
@ -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"
|
||||
|
@ -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 - <b>NOW!</b>" ;;
|
||||
|
Reference in New Issue
Block a user