From ca153cca933c0d5646a42e9c6b7adc8a91ea2a2a Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Sun, 26 Apr 2020 18:08:50 -0500 Subject: [PATCH] - Proper stop support on caret checking for xkeysnail --- xkeysnail-config/xkeysnail.service | 2 +- xkeysnail_service.sh | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/xkeysnail-config/xkeysnail.service b/xkeysnail-config/xkeysnail.service index d91f5a3..8fbc380 100644 --- a/xkeysnail-config/xkeysnail.service +++ b/xkeysnail-config/xkeysnail.service @@ -6,7 +6,7 @@ Type=simple KillMode=process ExecStartPre=/bin/bash -c "{xhost} +SI:localuser:root && /sbin/runuser -l {username} -c /home/{username}/.config/kinto/prexk.sh" ExecStart=/usr/bin/sudo /bin/bash -c '{experimental-caret}/home/{username}/.config/kinto/xkeystart.sh /tmp/kinto/kinto.py' -ExecStop=/usr/bin/sudo /usr/bin/killall xkeysnail +ExecStop=/bin/bash -c '/usr/bin/killall xkeysnail;{kill-caret}' Restart=on-failure RestartSec=3 Environment=DISPLAY={displayid} diff --git a/xkeysnail_service.sh b/xkeysnail_service.sh index 052e5fa..76fa085 100755 --- a/xkeysnail_service.sh +++ b/xkeysnail_service.sh @@ -19,8 +19,8 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1 while true; do read -p "Would you like to enable experimental support for mac back/forward hotkeys in Firefox & Chrome (shares the same hotkey combo as wordwise when needed)? (y/n)" yn case $yn in - [Yy]* ) exp='/sbin/runuser -l {username} -c "export DISPLAY={displayid};/home/{username}/.config/kinto/caret_status_xkey.sh\&";'; break;; - [Nn]* ) exp=" "; break;; + [Yy]* ) exp='/sbin/runuser -l {username} -c "export DISPLAY={displayid};/home/{username}/.config/kinto/caret_status_xkey.sh\&";'; expsh='"/home/{username}/.config/kinto/caret_status_xkey.sh"'; break;; + [Nn]* ) exp=" "; expsh=" " break;; # * ) echo "Please answer yes or no.";; esac done @@ -47,7 +47,12 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1 yes | cp -rf ./system-config/caret_status_xkey.sh ~/.config/kinto/caret_status_xkey.sh yes | cp -rf ./xkeysnail-config/xkeysnail.service ./xkeysnail-config/xkeysnail.service.new # yes | cp -rf ./xkeysnail-config/xkeysnail.timer ~/.config/systemd/user/xkeysnail.timer - sed -i "s#{experimental-caret}#$exp#g" ./xkeysnail-config/xkeysnail.service.new + sed -i "s#{experimental-caret}#$exp#g" ./xkeysnail-config/xkeysnail.service.new + if [ "$expsh" != " " ];then + sed -i "s#{kill-caret}#/usr/bin/pkill -f $expsh#g" ./xkeysnail-config/xkeysnail.service.new + else + sed -i "s#{kill-caret}#$expsh#g" ./xkeysnail-config/xkeysnail.service.new + fi sed -i "s/{username}/`whoami`/g" ./xkeysnail-config/xkeysnail.service.new sed -i "s#{xhost}#`which xhost`#g" ./xkeysnail-config/xkeysnail.service.new sed -i "s/{username}/`whoami`/g" ./xkeysnail-config/limitedadmins.new