diff --git a/distrobox/debian/wallpaper.pl b/distrobox/debian/wallpaper.pl index 5c9559d..d076e27 100755 --- a/distrobox/debian/wallpaper.pl +++ b/distrobox/debian/wallpaper.pl @@ -1,7 +1,7 @@ #!/bin/sh # distrobox_binary # name: debian -USE_DISPLAYS=`cat /var/home/jpm/.spool/wallpaper_outputs` +USE_DISPLAYS=`cat /var/home/jpm/.local/state/wallpaper_outputs` if [ ! -f /run/.containerenv ] && [ ! -f /.dockerenv ]; then command="/usr/bin/distrobox-enter -n debian -- /var/home/jpm/scripts/sway/wallpaper.pl --path=/var/home/jpm/wallpapers -d $USE_DISPLAYS " diff --git a/distrobox/toolbox/gammastep.pl b/distrobox/toolbox/gammastep.pl index b8186f0..c696ce4 100755 --- a/distrobox/toolbox/gammastep.pl +++ b/distrobox/toolbox/gammastep.pl @@ -13,10 +13,10 @@ my $lat_lon = fetch_lat_lon($location); my $pid = fork; unless ($pid) { - open(my $fh, ">", $ENV{HOME}."/.spool/gammastep.pid"); + open(my $fh, ">", $ENV{HOME}."/.local/state/gammastep.pid"); print $fh $$; close($fh); - open($fh, ">", $ENV{HOME}."/.spool/gammastep.status"); + open($fh, ">", $ENV{HOME}."/.local/state/gammastep.status"); print $fh 1; close($fh); diff --git a/ssh-agent.sh b/ssh-agent.sh index 5ca32c4..e432f50 100755 --- a/ssh-agent.sh +++ b/ssh-agent.sh @@ -1,17 +1,17 @@ #!/bin/bash -if [ -e "${HOME}/.spool/ssh-agent.sock" ]; then - PID=$(tail -n 1 "${HOME}/.spool/ssh-agent.env" | sed 's/echo Agent pid \([0-9]*\);/\1/') +if [ -e "${HOME}/.local/state/ssh-agent.sock" ]; then + PID=$(tail -n 1 "${HOME}/.local/state/ssh-agent.env" | sed 's/echo Agent pid \([0-9]*\);/\1/') if [ -z "$PID" ]; then - rm "${HOME}/.spool/ssh-agent.sock" "${HOME}/.spool/ssh-agent.pid" 2>/dev/null + rm "${HOME}/.local/state/ssh-agent.sock" "${HOME}/.local/state/ssh-agent.pid" 2>/dev/null pkill ssh-agent else CMD=$(ps -p "$PID" -o comm | tail -n 1) if [ -n "$CMD" ] && [ "$CMD" == 'ssh-agent' ]; then - echo "Valid agent already found at ${HOME}/.spool/ssh-agent.sock with PID $PID" + echo "Valid agent already found at ${HOME}/.local/state/ssh-agent.sock with PID $PID" exit fi fi fi -eval $(ssh-agent -a "${HOME}/.spool/ssh-agent.sock" | tee "${HOME}/.spool/ssh-agent.env") +eval $(ssh-agent -a "${HOME}/.local/state/ssh-agent.sock" | tee "${HOME}/.local/state/ssh-agent.env") diff --git a/sway/displays.pl b/sway/displays.pl index 9a7b526..0317338 100755 --- a/sway/displays.pl +++ b/sway/displays.pl @@ -34,7 +34,7 @@ use v5.36; # "width": __WIDTH__ (optional) my $waybar_template = "$ENV{'HOME'}/.dotfiles/waybar/config.template"; -my $swaysock = $ENV{'SWAYSOCK'} || $ENV{'HOME'} . "/.spool/sway-ipc.sock"; +my $swaysock = $ENV{'SWAYSOCK'} || $ENV{'HOME'} . "/.local/state/sway-ipc.sock"; # Path to actual config file generated from template my $waybar_config = "$ENV{'HOME'}/.dotfiles/waybar/config"; @@ -44,13 +44,13 @@ my $waybar_config = "$ENV{'HOME'}/.dotfiles/waybar/config"; my $waybar_bin = "/usr/bin/waybar"; # File to log and recover last used layout name -my $last = "$ENV{'HOME'}/.spool/last_display"; +my $last = "$ENV{'HOME'}/.local/state/last_display"; # File to log active outputs (used by swayidle, and to attempt to restore -my $active_outputs = "$ENV{'HOME'}/.spool/active_outputs"; +my $active_outputs = "$ENV{'HOME'}/.local/state/active_outputs"; # File to log which displays have a wallpaper active, will be written to restart wallpapers.pl -my $wallpaper_outputs .= "$ENV{'HOME'}/.spool/wallpaper_outputs"; +my $wallpaper_outputs .= "$ENV{'HOME'}/.local/state/wallpaper_outputs"; my @wallpapers; ######################################################################## diff --git a/sway/idle.sh b/sway/idle.sh index 259a879..e5c77b9 100755 --- a/sway/idle.sh +++ b/sway/idle.sh @@ -6,9 +6,9 @@ LOCK_TIMEOUT=300 # five minutes SLEEP_TIMEOUT=600 # ten minutes HIBERNATE_TIMEOUT=3600 # one hour -BLFILE="$HOME/.spool/idle.dim" -OPFILE="$HOME/.spool/active_outputs" -IDLEMODE=$(cat $HOME/.spool/idle_mode) +BLFILE="$HOME/.local/state/idle.dim" +OPFILE="$HOME/.local/state/active_outputs" +IDLEMODE=$(cat $HOME/.local/state/idle_mode) if [[ -n $2 ]]; then if [[ $2 == '--ignore_mode' ]]; then IDLEMODE='hibernate' @@ -95,13 +95,13 @@ elif [[ $1 == "stop" ]]; then pkill swayidle elif [[ $1 == "fade" ]]; then if [[ $IDLEMODE -gt 0 ]]; then - if [[ ! -e $HOME/.spool/sway-hidden ]]; then - kill -USR2 $(cat $HOME/.spool/sway-transparency) + if [[ ! -e $HOME/.local/state/sway-hidden ]]; then + kill -USR2 $(cat $HOME/.local/state/sway-transparency) fi fi elif [[ $1 == "unfade" ]]; then - if [[ -e $HOME/.spool/sway-hidden ]]; then - kill -USR2 $(cat $HOME/.spool/sway-transparency) + if [[ -e $HOME/.local/state/sway-hidden ]]; then + kill -USR2 $(cat $HOME/.local/state/sway-transparency) # TODO: This is a hack. There's no reason that waybar should be dead. #$HOME/scripts/sway/displays.pl -w fi @@ -130,7 +130,7 @@ elif [[ $1 == "unsleep" ]]; then #$HOME/scripts/sway/displays.pl cd $HOME/scripts/sway source $HOME/.dotfiles/bash/plenv-path.sh - $HOME/scripts/sway/displays.pl 2>&1 >$HOME/.spool/display_unsleep + $HOME/scripts/sway/displays.pl 2>&1 >$HOME/.local/state/display_unsleep elif [[ $1 == "hibernate" ]]; then if [[ $IDLEMODE -gt 4 ]]; then sudo systemctl suspend-then-hibernate.target diff --git a/sway/startsway.sh b/sway/startsway.sh index 28e92db..e9f0d7b 100755 --- a/sway/startsway.sh +++ b/sway/startsway.sh @@ -1,8 +1,8 @@ #!/bin/bash rm $HOME/.swaylog -echo sway > $HOME/.spool/last_login_gui +echo sway > $HOME/.local/state/last_login_gui export SSH_AUTH_SOCK=~/.ssh/ssh-agent.sock -export SWAYSOCK="$HOME/.spool/sway-ipc.sock" +export SWAYSOCK="$HOME/.local/state/sway-ipc.sock" export QT_QPA_PLATFORM="wayland-egl;wayland;xcb" export QT_QPA_PLATFORMTHEME=qt5ct export QML_IMPORT_PATH="/usr/lib/qt/qml" diff --git a/sway/sway-transparency.py b/sway/sway-transparency.py index 764e815..e153d8f 100755 --- a/sway/sway-transparency.py +++ b/sway/sway-transparency.py @@ -88,8 +88,8 @@ def set_all(ipc,opacity): else: window.command("opacity " + opacity) -flag = os.environ["HOME"]+"/.spool/sway-hidden" -pid = os.environ["HOME"]+"/.spool/sway-transparency" +flag = os.environ["HOME"]+"/.local/state/sway-hidden" +pid = os.environ["HOME"]+"/.local/state/sway-transparency" opacity = "0.85" if __name__ == "__main__": diff --git a/sway/toggle_outputs.sh b/sway/toggle_outputs.sh index 30d091b..efe86a9 100755 --- a/sway/toggle_outputs.sh +++ b/sway/toggle_outputs.sh @@ -1,6 +1,6 @@ #!/bin/bash -CURRENT=`cat /home/jpm/.spool/last_display` +CURRENT=`cat /home/jpm/.local/state/last_display` if [ "$CURRENT" == "x13" ]; then /home/jpm/scripts/sway/displays.pl Both diff --git a/sway/wallpaper.pl b/sway/wallpaper.pl index 2aeb17a..54f07ef 100755 --- a/sway/wallpaper.pl +++ b/sway/wallpaper.pl @@ -7,7 +7,6 @@ use v5.36; use POSIX; use File::Copy; -use lib "$ENV{HOME}/perl5/lib/perl5"; $ENV{PWD} = '/tmp' unless (defined($ENV{PWD})); use constant ERROR => { diff --git a/thinkpad/blc.pl b/thinkpad/blc.pl index a1d2047..3679e5a 100755 --- a/thinkpad/blc.pl +++ b/thinkpad/blc.pl @@ -67,8 +67,8 @@ my $cur_file = "/sys/class/backlight/intel_backlight/brightness"; chmod('0644',$cur_file) unless ( -w $cur_file ); my $max_file = "/sys/class/backlight/intel_backlight/max_brightness"; -my $cur_log = $ENV{HOME}."/.spool/blc.current"; -my $last_log = $ENV{HOME}."/.spool/blc.last"; +my $cur_log = $ENV{HOME}."/.local/state/blc.current"; +my $last_log = $ENV{HOME}."/.local/state/blc.last"; sub to_percent { diff --git a/thinkpad/kbd_backlight.pl b/thinkpad/kbd_backlight.pl index b24a670..ae3fd6b 100755 --- a/thinkpad/kbd_backlight.pl +++ b/thinkpad/kbd_backlight.pl @@ -5,7 +5,7 @@ use warnings; our $maxfile = "/sys/class/leds/tpacpi\:\:kbd_backlight/max_brightness"; our $current = "/sys/class/leds/tpacpi\:\:kbd_backlight/brightness"; -our $sleepfile = "$ENV{HOME}/.spool/kbd_sleep"; +our $sleepfile = "$ENV{HOME}/.local/state/kbd_sleep"; sub readFile { diff --git a/tofi/power/⏻ Shutdown b/tofi/power/⏻ Shutdown index e69fc47..b90a698 100755 --- a/tofi/power/⏻ Shutdown +++ b/tofi/power/⏻ Shutdown @@ -1,3 +1,3 @@ #!/bin/bash -rm /var/home/jpm/.spool/ssh-agent.sock +rm /var/home/jpm/.local/state/ssh-agent.sock systemctl poweroff -i diff --git a/tofi/power/🡙 Reboot b/tofi/power/🡙 Reboot index e2fd573..e1af64d 100755 --- a/tofi/power/🡙 Reboot +++ b/tofi/power/🡙 Reboot @@ -1,3 +1,3 @@ #!/bin/bash -rm /var/home/jpm/.spool/ssh-agent.sock +rm /var/home/jpm/.local/state/ssh-agent.sock systemctl reboot -i diff --git a/waybar/toggle.sh b/waybar/toggle.sh index 897200b..98f80e5 100755 --- a/waybar/toggle.sh +++ b/waybar/toggle.sh @@ -6,21 +6,21 @@ if [[ $ARG == '' ]]; then fi if [[ $ARG == 'toggle' ]]; then - if [[ -e '/home/jpm/.config/waybar/.hidden' ]]; then - rm '/home/jpm/.config/waybar/.hidden'; + if [[ -e '/home/jpm/.local/state/.waybar_hidden' ]]; then + rm '/home/jpm/.local/state/.waybar_hidden'; else - touch '/home/jpm/.config/waybar/.hidden'; + touch '/home/jpm/.local/state/.waybar_hidden'; fi elif [[ $ARG == 'hide' ]]; then - if [[ ! -e '/home/jpm/.config/waybar/.hidden' ]]; then - touch '/home/jpm/.config/waybar/.hidden'; + if [[ ! -e '/home/jpm/.local/state/.waybar_hidden' ]]; then + touch '/home/jpm/.local/state/.waybar_hidden'; else echo 'Already hidden. You may need to use the "invert" option if action is reversed'; exit; fi elif [[ $ARG == 'show' ]]; then - if [[ -e '/home/jpm/.config/waybar/.hidden' ]]; then - rm '/home/jpm/.config/waybar/.hidden'; + if [[ -e '/home/jpm/.local/state/.waybar_hidden' ]]; then + rm '/home/jpm/.local/state/.waybar_hidden'; else echo 'Already shown. You may need to use the "invert" option if action is reversed'; exit; @@ -29,4 +29,5 @@ elif [[ $ARG != 'invert' ]]; then echo "Invalid argument"; fi -/home/jpm/scripts/waybar/toggle `pgrep waybar` +BARS=$(pgrep waybar | cut -d ' ' -f 1) +kill -s SIGUSR1 $BARS diff --git a/waybar/waybar-backlight.sh b/waybar/waybar-backlight.sh index 8b7c83f..7083426 100755 --- a/waybar/waybar-backlight.sh +++ b/waybar/waybar-backlight.sh @@ -48,5 +48,5 @@ else fi echo $NOTIFY_ID > /tmp/brightness-notification -echo $BRIGHTNESS > ${HOME}/.spool/last_brightness +echo $BRIGHTNESS > ${HOME}/.local/state/last_brightness rm $LOCK diff --git a/waybar/waybar-debian.sh b/waybar/waybar-debian.sh index a9fd08e..b3cf441 100755 --- a/waybar/waybar-debian.sh +++ b/waybar/waybar-debian.sh @@ -1,13 +1,13 @@ #!/bin/bash if [ "$1" == 'bar' ]; then - if [ ! -e ${HOME}/.spool/apt-upgradeable ]; then + if [ ! -e ${HOME}/.local/state/apt-upgradeable ]; then sudo apt update >/dev/null 2>/dev/null COUNT=`apt list --upgradable 2> /dev/null | wc -l` let COUNT-- - echo $COUNT > /home/jpm/.spool/apt-upgradeable + echo $COUNT > /home/jpm/.local/state/apt-upgradeable else - COUNT=`cat ${HOME}/.spool/apt-upgradeable` + COUNT=`cat ${HOME}/.local/state/apt-upgradeable` fi if [ $COUNT -eq 0 ]; then echo '{"text": "🗹", "tooltip": "Up-to-date", "class": "up-to-date"}' @@ -22,7 +22,7 @@ elif [ "$1" == 'upgrade' ]; then /usr/bin/uxterm -e "sudo apt-get update && sudo apt-get full-upgrade -y && sudo apt-get autoremove -y && sudo apt-get clean -y && exit" COUNT=`apt list --upgradable 2> /dev/null | wc -l` let COUNT-- - echo $COUNT > /home/jpm/.spool/apt-upgradeable + echo $COUNT > /home/jpm/.local/state/apt-upgradeable if [ -e /var/run/reboot-required ]; then grep -B1 -A4 upgrade /var/log/apt/history.log | tail -n 6 | swaynag --config=${HOME}/.dotfiles/sway/swaynag --edge=bottom --message="New packages require restart" --button="Restart Now" "sudo systemctl reboot" --dismiss-button="Later" --detailed-message --detailed-button "Show/Hide Upgrade Details" fi @@ -30,7 +30,7 @@ elif [ "$1" == 'update' ]; then sudo apt update >/dev/null 2>/dev/null COUNT=`apt list --upgradable 2> /dev/null | wc -l` let COUNT-- - echo $COUNT > /home/jpm/.spool/apt-upgradeable + echo $COUNT > /home/jpm/.local/state/apt-upgradeable else echo "Missing argument: update, upgrade, bar" fi diff --git a/waybar/waybar-fedora-silverblue.sh b/waybar/waybar-fedora-silverblue.sh index a379aa8..530e9de 100755 --- a/waybar/waybar-fedora-silverblue.sh +++ b/waybar/waybar-fedora-silverblue.sh @@ -11,11 +11,11 @@ function count() { } if [ "$1" == 'bar' ]; then - if [ ! -e ${HOME}/.spool/ostree-upgradeable ]; then + if [ ! -e ${HOME}/.local/state/ostree-upgradeable ]; then count - echo $COUNT > /home/jpm/.spool/ostree-upgradeable + echo $COUNT > /home/jpm/.local/state/ostree-upgradeable else - COUNT=`cat ${HOME}/.spool/ostree-upgradeable` + COUNT=`cat ${HOME}/.local/state/ostree-upgradeable` fi if [ $COUNT -eq 0 ]; then echo '{"text": "🗹", "tooltip": "Up-to-date", "class": "up-to-date"}' @@ -29,10 +29,10 @@ elif [ $UID -eq 0 ]; then elif [ "$1" == 'upgrade' ]; then /usr/bin/uxterm -e "rpm-ostree upgrade" count - echo $COUNT > /home/jpm/.spool/ostree-upgradeable + echo $COUNT > /home/jpm/.local/state/ostree-upgradeable elif [ "$1" == 'update' ]; then count - echo $COUNT > /home/jpm/.spool/ostree-upgradeable + echo $COUNT > /home/jpm/.local/state/ostree-upgradeable else echo "Missing argument: update, upgrade, bar" fi diff --git a/waybar/waybar-gammastep.sh b/waybar/waybar-gammastep.sh index 5922cf5..8317e23 100755 --- a/waybar/waybar-gammastep.sh +++ b/waybar/waybar-gammastep.sh @@ -2,8 +2,8 @@ PID=$(pgrep gammastep) RUNNING=0 -if [ -e $HOME/.spool/gammastep.status ]; then - RUNNING=`cat $HOME/.spool/gammastep.status` +if [ -e $HOME/.local/state/gammastep.status ]; then + RUNNING=`cat $HOME/.local/state/gammastep.status` fi ACTION=$1 @@ -17,9 +17,9 @@ elif [[ $ACTION == 'toggle' ]]; then if [ ! -z $PID ]; then kill -SIGUSR1 $PID if [[ $RUNNING == 0 ]]; then - echo 1 > $HOME/.spool/gammastep.status + echo 1 > $HOME/.local/state/gammastep.status else - echo 0 > $HOME/.spool/gammastep.status + echo 0 > $HOME/.local/state/gammastep.status fi else echo 'Gammastep is not running' @@ -42,7 +42,7 @@ elif [[ $ACTION == 'enable' ]]; then echo 'Already enabled' else kill -SIGUSR1 $PID - echo 1 > $HOME/.spool/gammastep.status + echo 1 > $HOME/.local/state/gammastep.status fi else echo 'Gammastep is not running' @@ -51,7 +51,7 @@ elif [[ $ACTION == 'disable' ]]; then if [ ! -z $PID ]; then if [ $RUNNING ]; then kill -SIGUSR1 $PID - echo 0 > $HOME/.spool/gammastep.status + echo 0 > $HOME/.local/state/gammastep.status else echo 'Already disabled' fi @@ -63,8 +63,8 @@ else fi RUNNING=0 -if [ -e $HOME/.spool/gammastep.status ]; then - RUNNING=`cat $HOME/.spool/gammastep.status` +if [ -e $HOME/.local/state/gammastep.status ]; then + RUNNING=`cat $HOME/.local/state/gammastep.status` fi if [[ $RUNNING == 0 ]]; then echo '{"text":"ɣ","icon":"ɣ","tooltip":"Enable Gammastep","class":"disabled"}' diff --git a/waybar/waybar-hibernate.sh b/waybar/waybar-hibernate.sh index 54eb05e..a3e4ffc 100755 --- a/waybar/waybar-hibernate.sh +++ b/waybar/waybar-hibernate.sh @@ -1,6 +1,6 @@ #!/bin/bash -FILE="$HOME/.spool/hibernate_inhibitor" +FILE="$HOME/.local/state/hibernate_inhibitor" if [ -e $FILE ]; then INHIBITED=1 else diff --git a/waybar/waybar-idle.sh b/waybar/waybar-idle.sh index 98932cc..10a6579 100755 --- a/waybar/waybar-idle.sh +++ b/waybar/waybar-idle.sh @@ -1,6 +1,6 @@ #!/bin/bash -FILE="$HOME/.spool/idle_mode" +FILE="$HOME/.local/state/idle_mode" if [[ -z $1 ]] || [[ "$1" == 'rotate' ]] || [[ "$1" == 'bar' ]]; then if [[ -e $FILE ]]; then MODE=$(cat $FILE) diff --git a/waybar/waybar-keyboard.sh b/waybar/waybar-keyboard.sh index 4651660..af878dc 100755 --- a/waybar/waybar-keyboard.sh +++ b/waybar/waybar-keyboard.sh @@ -1,6 +1,6 @@ #!/bin/bash -FILE=/home/jpm/.spool/onscreen-keyboard +FILE=/home/jpm/.local/state/onscreen-keyboard if [ -f $FILE ]; then rm $FILE busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b false diff --git a/waybar/waybar-pkg.sh b/waybar/waybar-pkg.sh index 7e46a75..72cc9b7 100755 --- a/waybar/waybar-pkg.sh +++ b/waybar/waybar-pkg.sh @@ -8,7 +8,7 @@ if [ -n "$VARIANT" ]; then fi # Build log file for upgradeable package counts/errors -COUNT_FILE="$HOME/.spool/upgradeable" +COUNT_FILE="$HOME/.local/state/upgradeable" if [ -f "/run/.containerenv" ] || [ -f "/.dockerenv" ]; then COUNT_FILE="$COUNT_FILE.$(echo "$HOSTNAME" | cut -d'.' -f1)" fi diff --git a/waybar/waybar-volume.sh b/waybar/waybar-volume.sh index 3a6f007..0bbb9c8 100755 --- a/waybar/waybar-volume.sh +++ b/waybar/waybar-volume.sh @@ -27,9 +27,9 @@ fi VOLUME=$(pactl get-sink-volume $SINK | grep Volume | sed -r 's/.* (1?[0-9]?[0-9])% \/.*/\1/') if [[ $ACTION != "set-sink-volume $SINK +1%" ]] && [[ $VOLUME -eq 0 ]]; then - echo $VOLUME > ${HOME}/.spool/last_volume + echo $VOLUME > ${HOME}/.local/state/last_volume elif [[ $ACTION != "set-sink-volume $SINK -1%" ]] && [[ $VOLUME -eq 150 ]]; then - echo $VOLUME > ${HOME}/.spool/last_volume + echo $VOLUME > ${HOME}/.local/state/last_volume elif [[ $ACTION != "get-sink-volume $SINK" ]]; then pactl $ACTION VOLUME=$(pactl get-sink-volume $SINK | grep Volume | sed -r 's/.* (1?[0-9]?[0-9])% \/.*/\1/') @@ -53,5 +53,5 @@ fi VOLUME=$(pactl get-sink-volume $SINK | grep Volume | sed -r 's/.* (1?[0-9]?[0-9])% \/.*/\1/') echo $NOTIFY_ID > /tmp/volume-notification -echo $VOLUME > ${HOME}/.spool/last_volume +echo $VOLUME > ${HOME}/.local/state/last_volume rm /tmp/volume-lock