diff --git a/system-config/keyswap.service b/system-config/keyswap.service index cfc5896..38a1fce 100755 --- a/system-config/keyswap.service +++ b/system-config/keyswap.service @@ -8,9 +8,9 @@ Restart=always # eg DISPLAY=:0.0 #Environment=DISPLAY={displayid} RestartSec=1 -WorkingDirectory=/home/{username}/.config/kinto -ExecStart=/bin/bash -c "/home/{username}/.config/kinto/xactive.sh carrots" -ExecStop=/bin/bash /home/{username}/.config/kinto/cleanup.sh +WorkingDirectory={homedir}/.config/kinto +ExecStart=/bin/bash -c "{homedir}/.config/kinto/xactive.sh carrots" +ExecStop=/bin/bash {homedir}/.config/kinto/cleanup.sh [Install] WantedBy=default.target diff --git a/xkeysnail-config/prexk.sh b/xkeysnail-config/prexk.sh index 1b4053a..61df280 100755 --- a/xkeysnail-config/prexk.sh +++ b/xkeysnail-config/prexk.sh @@ -1,14 +1,13 @@ #!/bin/bash - -if [ -f /home/{username}/.config/systemd/user/keyswap.timer ]; then +if [ -f {homedir}/.config/systemd/user/keyswap.timer ]; then systemctl --user stop keyswap.timer >/dev/null 2>&1 systemctl --user disable keyswap.timer >/dev/null 2>&1 fi -if [ -f /home/{username}/.config/systemd/user/keyswap.service ]; then +if [ -f {homedir}/.config/systemd/user/keyswap.service ]; then systemctl --user stop keyswap >/dev/null 2>&1 systemctl --user disable keyswap >/dev/null 2>&1 fi # export DISPLAY={displayid};/usr/bin/xhost +SI:localuser:root mkdir -p /tmp/kinto/xkeysnail -cp /home/{username}/.config/kinto/kinto.py /tmp/kinto/xkeysnail/kinto.py \ No newline at end of file +cp {homedir}/.config/kinto/kinto.py /tmp/kinto/xkeysnail/kinto.py diff --git a/xkeysnail-config/xkeysnail.service b/xkeysnail-config/xkeysnail.service index c817db8..c7c6276 100644 --- a/xkeysnail-config/xkeysnail.service +++ b/xkeysnail-config/xkeysnail.service @@ -4,12 +4,12 @@ Description=xkeysnail [Service] 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/xkeysnail/kinto.py' +ExecStartPre=/bin/bash -c "{xhost} +SI:localuser:root && /sbin/runuser -l {username} -c {homedir}/.config/kinto/prexk.sh" +ExecStart=/usr/bin/sudo /bin/bash -c '{experimental-caret}{homedir}/.config/kinto/xkeystart.sh /tmp/kinto/xkeysnail/kinto.py' ExecStop=/bin/bash -c 'me=$$;ps -ef | grep \'[t]mp/kinto\' | awk -v me=$me \'$2 != me {print $2}\' | xargs kill;/usr/bin/killall dbus-monitor;/usr/bin/killall xkeysnail;{kill-caret}' Restart=on-failure RestartSec=3 Environment=DISPLAY={displayid} [Install] -WantedBy=graphical.target \ No newline at end of file +WantedBy=graphical.target diff --git a/xkeysnail_service.sh b/xkeysnail_service.sh index 944d8f5..2e34a09 100755 --- a/xkeysnail_service.sh +++ b/xkeysnail_service.sh @@ -173,7 +173,7 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "4" || $1 == "kintowin" || $1 while true; do read -rep $'\nExperimental Support for Firefox/Chrome Back/Forward hotkeys (Cmd+Left/Right)?\n(Keys could get stuck, switch windows or press ctrl &/or super to release) (y/n)\n' yn case $yn in - [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;; + [Yy]* ) exp='/sbin/runuser -l {username} -c "export DISPLAY={displayid};{homedir}/.config/kinto/caret_status_xkey.sh\&";'; expsh='"{homedir}/.config/kinto/caret_status_xkey.sh"'; break;; [Nn]* ) exp=" "; expsh=" " break;; # * ) echo "Please answer yes or no.";; esac @@ -214,7 +214,7 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "4" || $1 == "kintowin" || $1 # echo "Transferring files..." mkdir -p ~/.config/kinto - + # KDE xhost fix mkdir -p ~/.kde/Autostart echo -e '#!/bin/sh\rxhost +SI:localuser:root' > ~/.kde/Autostart/kintohost.sh @@ -237,14 +237,16 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "4" || $1 == "kintowin" || $1 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#{homedir}#`echo "$HOME"`#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 + sed -i "s#{homedir}#`echo "$HOME"`#g" ./xkeysnail-config/limitedadmins.new sed -i "s#{systemctl}#`which systemctl`#g" ./xkeysnail-config/limitedadmins.new sudo chown root:root ./xkeysnail-config/limitedadmins.new sudo mv ./xkeysnail-config/limitedadmins.new /etc/sudoers.d/limitedadmins sed -i "s#{systemctl}#`which systemctl`#g" ~/.config/autostart/xkeysnail.desktop sed -i "s#{xhost}#`which xhost`#g" ~/.config/autostart/xkeysnail.desktop - sed -i "s/{username}/`whoami`/g" ~/.config/kinto/prexk.sh + sed -i "s#{homedir}#`echo "$HOME"`#g" ~/.config/kinto/prexk.sh sed -i "s/{displayid}/`echo "$DISPLAY"`/g" ./xkeysnail-config/xkeysnail.service.new sed -i "s/{displayid}/`echo "$DISPLAY"`/g" ~/.config/kinto/prexk.sh @@ -381,4 +383,4 @@ elif [[ $1 == "5" || $1 == "budgieUpdate" ]]; then budgieUpdate else echo "Expected argument was not provided" -fi \ No newline at end of file +fi