From 791ab4e94ad262da9fd376d3792c848e73ef435a Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Sat, 1 Aug 2020 03:30:40 -0500 Subject: [PATCH] - Updated Budgie Applet to stopping xkeysnail universally --- xkeysnail-config/limitedadmins | 2 ++ xkeysnail-config/root_logoff.sh | 6 ++++++ xkeysnail-config/xkeysnail.desktop | 2 +- xkeysnail_service.sh | 8 ++++++-- 4 files changed, 15 insertions(+), 3 deletions(-) create mode 100755 xkeysnail-config/root_logoff.sh diff --git a/xkeysnail-config/limitedadmins b/xkeysnail-config/limitedadmins index 7ccec01..b140516 100644 --- a/xkeysnail-config/limitedadmins +++ b/xkeysnail-config/limitedadmins @@ -3,4 +3,6 @@ %{username} ALL=NOPASSWD: {systemctl} start xkeysnail %{username} ALL=NOPASSWD: {systemctl} stop xkeysnail %{username} ALL=NOPASSWD: {systemctl} status xkeysnail +%{username} ALL=(root) NOPASSWD: /usr/local/bin/logoff.sh +%{username} ALL=NOPASSWD: {pkill} -f logoff %{username} ALL=NOPASSWD: {systemctl} is-active --quiet xkeysnail diff --git a/xkeysnail-config/root_logoff.sh b/xkeysnail-config/root_logoff.sh new file mode 100755 index 0000000..d2af6e2 --- /dev/null +++ b/xkeysnail-config/root_logoff.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# /usr/local/bin/logoff.sh +while true; do + w | grep -E "$1.*$2" > /dev/null 2>&1 || (sudo systemctl stop xkeysnail && sudo pkill -f logoff) + sleep 5 +done \ No newline at end of file diff --git a/xkeysnail-config/xkeysnail.desktop b/xkeysnail-config/xkeysnail.desktop index 8893956..bd55e6f 100644 --- a/xkeysnail-config/xkeysnail.desktop +++ b/xkeysnail-config/xkeysnail.desktop @@ -2,7 +2,7 @@ Name=Kinto_xkey GenericName=Kinto_xkey Comment=Make Linux Type Like it's a Mac -Exec=/bin/bash -c "grep -q 'autostart = true' {homedir}/.config/kinto/kinto.py && {xhost} +SI:localuser:root && sudo {systemctl} restart xkeysnail;{homedir}/.config/kinto/gnome_logoff.sh" +Exec=/bin/bash -c "grep -q 'autostart = true' {homedir}/.config/kinto/kinto.py && {xhost} +SI:localuser:root && sudo {systemctl} restart xkeysnail;sudo /usr/local/bin/logoff.sh $USER $DISPLAY" Terminal=false Type=Application X-GNOME-Autostart-enabled=true \ No newline at end of file diff --git a/xkeysnail_service.sh b/xkeysnail_service.sh index ddbe8a3..4b48aad 100755 --- a/xkeysnail_service.sh +++ b/xkeysnail_service.sh @@ -101,7 +101,7 @@ function trayApp { sudo ./install-applet.sh cd ../../../ echo "Please logoff and back on for the Applet to be available for the top panel." - ~/.config/kinto/gnome_logoff.sh& + sudo /usr/local/bin/logoff.sh $USER $DISPLAY& fi else while true; do @@ -271,7 +271,10 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1 yes | cp -rf ./xkeysnail-config/xkeysnail.desktop ~/.config/autostart/xkeysnail.desktop # yes | cp -rf ./xkeysnail-config/xkeystart.sh ~/.config/kinto/xkeystart.sh - yes | cp -rf ./xkeysnail-config/gnome_logoff.sh ~/.config/kinto/gnome_logoff.sh + yes | sudo cp -rf xkeysnail-config/root_logoff.sh /usr/local/bin/logoff.sh + sudo chown root:root /usr/local/bin/logoff.sh + sudo chmod u+rwx /usr/local/bin/logoff.sh + sudo chmod go-w+rx /usr/local/bin/logoff.sh yes | cp -rf ./xkeysnail-config/kinto.py ./xkeysnail-config/kinto.py.new yes | cp -rf ./xkeysnail-config/limitedadmins ./xkeysnail-config/limitedadmins.new # yes | cp -rf ./xkeysnail-config/prexk.sh ~/.config/kinto/prexk.sh @@ -289,6 +292,7 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1 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#{systemctl}#`\\which systemctl`#g" ./xkeysnail-config/limitedadmins.new + sed -i "s#{pkill}#`\\which pkill`#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