260529.3 · 91e76294d0c9dd823fa0fcb32e52ac83a9b8a1cb
bin: fix some mistakes with process handling
The main bug here was that `pgrep` silently doesn't match when the process name is longer than 15 characters. At first I was quite annoyed at pgrep, but this actually looks like a Linux kernel pecadillo. Quite annoying.
reading declarations
@@ -6,7 +6,5 @@ if [ -z "$process" ]; then echo "Usage: $(basename "$0") <process-name>" >&2 exit 1 fi-if pgrep "^$process$" &> /dev/null; then- killall "$process"-fi+pgrep -f "(^|/)$process($|\\s+)" | xargs -r kill exec "$process" "$@"
@@ -6,7 +6,7 @@ if [ -z "$process" ]; then echo "Usage: $(basename "$0") <process-name>" >&2 exit 1 fi-if pgrep -q "^$process$" &> /dev/null; then+if pgrep -f "(^|/)$process($|\\s+)" &> /dev/null; then exit 0 fi exec "$process" "$@"
@@ -5,30 +5,3 @@ set -e process-running xconfig-self-healing & process-running xbindkeys--case "$(myhostname)" in- monty)- xset m 2 1- ;;- kodos)- system76-darter-set-kbd-backlight- system76-darter-configure-touchpad- kait-ssh-add-keys- ;;- kang)- framework-configure-touchpad- sudo framework_tool --fp-brightness low- ;;- bart)- framework-configure-touchpad- ;;- chalmers|skinner|wiggum|otto|flanders|milhouse)- no-blanking- xset m 3 1- ;;- duff|frink)- xset m 1 1- xinput --set-prop 'Logitech Anywhere MX' 'libinput Accel Speed' -0.75- xinput --set-prop 'pointer:Logitech MX Anywhere 2' 'libinput Accel Speed' -0.75- ;;-esac
@@ -15,6 +15,21 @@ apply() { setxkbmap -option terminate:ctrl_alt_bksp xset r rate "$delay" "$rate" >/dev/null 2>&1 xset b 0++ case "$(myhostname)" in+ bart|kang)+ framework-configure-touchpad+ ;;+ wiggum|otto|flanders|milhouse)+ no-blanking+ xset m 3 1+ ;;+ duff|frink)+ xset m 1 1+ xinput --set-prop 'Logitech Anywhere MX' 'libinput Accel Speed' -0.75+ xinput --set-prop 'pointer:Logitech MX Anywhere 2' 'libinput Accel Speed' -0.75+ ;;+ esac } apply