File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,8 +19,8 @@ export COLOR=1; case $TERM in
1919 * ) [ $( tput colors) -lt 8 ] && unset COLOR
2020esac
2121
22- # persist $OLDPWD between sessions
23- export LASTDIR=" ${XDG_RUNTIME_DIR:-/ tmp} /.oldpwd"
22+ # persist $OLDPWD between shells on same login session
23+ export LASTDIR=" ${XDG_RUNTIME_DIR:-/ tmp} /.oldpwd. $XDG_SESSION_ID "
2424[ -f " $LASTDIR " ] && read -r OLDPWD < " $LASTDIR "
2525
2626# truncate long prompt pathnames over N characters
Original file line number Diff line number Diff line change @@ -48,8 +48,10 @@ ctrl + alt + {Delete,Insert}
4848 visual {htop,watch -c -n 0.1 'dmesg -e -Lalways | tac'}
4949# rotate display orientation
5050shift + super + {Up,Down,Left,Right}
51+ PITCHED_SFX(cncl03) \
5152 sfx-synth btn & \
52- echo '{bottom-up,normal,right-up,left-up}' >> ~/.rotate
53+ echo '{bottom-up,normal,right-up,left-up}' \
54+ > "$XDG_RUNTIME_DIR/.rotate.$XDG_SESSION_ID"
5355
5456## function keys
5557# F1: power/reboot
Original file line number Diff line number Diff line change 2222[ ! -z " $xopt " ] && xopt=" -config $( id -u) -override/$xopt .conf"
2323
2424# record time at startup
25- date ' +%s%N' > " $XDG_RUNTIME_DIR /.$XDG_SESSION_TYPE$XDG_VTNR "
25+ date ' +%s%N' > " $XDG_RUNTIME_DIR /.xinit-st. $XDG_SESSION_ID "
2626exec /usr/bin/startx " $@ " -- $xopt
Original file line number Diff line number Diff line change @@ -13,19 +13,23 @@ dpy_digitizer="$(xinput list --name-only | grep -i wacom)"
1313# detect laptop mouse pointer devices
1414ptr_devices=" $( xinput list --name-only | egrep -i ' (touchpad|trackpoint)' ) "
1515
16- trap ' kill $!' 0 1 2 3 6 15
16+ abort () {
17+ kill $!
18+ rm -rf " $R_FIFO "
19+ }
20+ trap abort 0 1 2 3 6 15
1721
1822# workarounds for iio-sensor-proxy
19- # repeatedly poke accelerometer on a timer to avoid aggressive battery optimization
23+ # repeatedly poke sensor on a timer to avoid aggressive battery optimization
2024while : ; do
2125 cat /sys/bus/iio/devices/iio:device0/in_accel_x_raw > /dev/null
2226 sleep 2
2327done &
2428
25- # sxhkd: allows manual override if and when accelerometer stops responding
26- RFIFO =" $HOME /.rotate"
27- [ ! -p " $RFIFO " ] && mkfifo " $RFIFO "
28- monitor-sensor >> " $RFIFO " &
29+ # rotation FIFO for external control via sxhkd
30+ R_FIFO =" $XDG_RUNTIME_DIR /.rotate. $XDG_SESSION_ID "
31+ [ ! -p " $R_FIFO " ] && mkfifo " $R_FIFO "
32+ monitor-sensor >> " $R_FIFO " &
2933
3034while read -r line; do
3135 state=" ${line##* } "
@@ -53,4 +57,4 @@ while read -r line; do
5357 [ " $rot " = " normal" ] && xinput enable " $f " || xinput disable " $f "
5458 done &
5559 fi
56- done < " $RFIFO "
60+ done < " $R_FIFO "
Original file line number Diff line number Diff line change 44# send notifications and OSD messages through xwin-statusd
55# accepts message arguments or first line passed through stdin
66
7- NFIFO =" $HOME /.notify"
8- [ -p " $NFIFO " ] ||
9- { echo " ${0##*/ } : Cannot write to '$NFIFO ', exiting." 1>&2 ; exit 1; }
7+ N_FIFO =" $XDG_RUNTIME_DIR /.notify. $XDG_SESSION_ID "
8+ [ -p " $N_FIFO " ] ||
9+ { echo " ${0##*/ } : Cannot write to '$N_FIFO ', exiting." 1>&2 ; exit 1; }
1010
1111unset SECS
1212case " $1 " in
@@ -15,5 +15,5 @@ case "$1" in
1515esac
1616SECS=" ${SECS:- 5} " # default is 5 seconds
1717
18- echo " $SECS ${@:- $(cat / dev/ stdin)} " >> " $HOME /.notify "
18+ echo " $SECS ${@:- $(cat / dev/ stdin)} " >> " $N_FIFO "
1919
Original file line number Diff line number Diff line change @@ -13,8 +13,10 @@ export XDG_CONFIG_HOME="$HOME/.config"
1313
1414# force cache writes to ramdisk
1515# fallback to /tmp if pam_systemd doesn't provide ramdisk
16+ # fallback unique session ID on non-systemd systems
1617export XDG_RUNTIME_DIR=" ${XDG_RUNTIME_DIR:-/ tmp} "
1718export XDG_CACHE_HOME=" $XDG_RUNTIME_DIR "
19+ export XDG_SESSION_ID=" ${XDG_SESSION_ID:- $$ } "
1820
1921# persist for current session only, return 0 on logout
2022trap ' ssh-agent -k > /dev/null || :' 0 1 3 6 15
Original file line number Diff line number Diff line change @@ -102,11 +102,12 @@ urxvtd -o &
102102otd-daemon &
103103lxpolkit &
104104
105- # # profiling and housekeeping
106- read st < " $XDG_RUNTIME_DIR /.$XDG_SESSION_TYPE$XDG_VTNR "
105+ # # startup profiling and housekeeping
106+ timest=" $XDG_RUNTIME_DIR /.xinit-st.$XDG_SESSION_ID "
107+ read st < " $timest "
107108ed=$( date ' +%s%N' )
108109{
109- rm -rf ~ / wget-log*
110+ rm -rf " $timest " wget-log*
110111 sleep 1
111112 echo " ~/${0##*/ } finished in $(( (ed - st) / 1000000 )) ms." | notify-send -t 0.5
112113} &
Original file line number Diff line number Diff line change @@ -24,39 +24,38 @@ for f in $pad $quote; do # surround output with special characters
2424done
2525unset IFS
2626
27- # FIFO locations
27+ # status bar FIFO path not exposed to other scripts for stability
2828prog=" ${0##*/ } "
29- key=" $( tr -cd ' a-z0-9' < /dev/urandom | dd bs=7 count=1 2> /dev/null) "
30- FIFO=" ${XDG_RUNTIME_DIR:-/ tmp} /.${prog% .* } .$key "
29+ S_FIFO=" ${XDG_RUNTIME_DIR:-/ tmp} /.${prog% .* } .$$ "
3130
3231# notification FIFO written to by notify-send
33- NFIFO =" $HOME /.notify"
32+ N_FIFO =" $XDG_RUNTIME_DIR /.notify. $XDG_SESSION_ID "
3433
3534abort () {
36- rm -rf " $FIFO " " $NFIFO "
35+ rm -rf " $S_FIFO " " $N_FIFO "
3736 echo " [!] ${0##*/ } terminated unexpectedly" | sed -e " $script "
3837 kill -- -$$ > /dev/null 2>&1
3938}
4039
4140trap abort 0 1 2 3 6 15
42- mkfifo " $FIFO " " $NFIFO "
41+ mkfifo " $S_FIFO " " $N_FIFO "
4342
4443# monitor and redirect notifications from notify-send
4544# prevent named pipe from closing
4645{ while : ; do
47- while read -r msg < " $NFIFO " ; do
46+ while read -r msg < " $N_FIFO " ; do
4847 echo " MSG $msg "
4948 done
5049 done
51- } > " $FIFO " &
50+ } > " $S_FIFO " &
5251
5352# thread loop
5453launch () {
5554 while : ; do
5655 sleep " $2 " &
5756 " $1 "
5857 wait
59- done > " $FIFO " &
58+ done > " $S_FIFO " &
6059}
6160
6261# individual threads
@@ -268,4 +267,4 @@ while read -r module data; do
268267 # output final formatted status line
269268 echo " $bar " | sed -e " $script "
270269
271- done < " $FIFO "
270+ done < " $S_FIFO "
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ ffmpeg_cat() {
7474
7575# remove trash from previous iterations
7676rm -rf " $XDG_RUNTIME_DIR /${0##*/ } " *
77- temp=" $XDG_RUNTIME_DIR /${0##*/ } - $$ " && mkdir -p " $temp "
77+ temp=" $XDG_RUNTIME_DIR /${0##*/ } . $$ " && mkdir -p " $temp "
7878
7979# pcmanfm will randomly re-read wallpaper files after they're deleted, leading
8080# to black screens, just leave temp dir trash to be cleaned up on next run
You can’t perform that action at this time.
0 commit comments