mirror of
https://github.com/rbreaves/kinto.git
synced 2025-07-31 16:26:39 +02:00
- Corrected some caret check logic, updated autostart for xkeysnail
This commit is contained in:
@@ -20,37 +20,37 @@ while (true);do
|
||||
# Sets original config
|
||||
perl -pi -e "s/[^\n]\s{3}#\s(K.*)(# Beginning of Line)/\$2\$3/g" /tmp/kinto/kinto.py
|
||||
perl -pi -e "s/[^\n]\s{3}#\s(K.*)(# End of Line)/\$2\$3/g" /tmp/kinto/kinto.py
|
||||
perl -pi -e "s/[^\n]\s{3}(K.*)(# Firefox-nw)/# \$1\$2/g" /tmp/kinto/kinto.py
|
||||
perl -pi -e "s/[^\n]\s{3}(K.*)(# Firefox-nw)/ # \$1\$2/g" /tmp/kinto/kinto.py
|
||||
lastcheck=1
|
||||
ww=1
|
||||
elif [ "${check}" == "ff nw" ] && [ "${lastcheck}" != 2 ]; then
|
||||
echo "firefox no wordwise"
|
||||
# echo "$check"
|
||||
# Sets new config
|
||||
perl -pi -e "s/[^\n]\s{3}#\s(K.*)(# Firefox-nw)/\$2\$3/g" /tmp/kinto/kinto.py
|
||||
perl -pi -e "s/[^\n]\s{3}(K.*)(# Beginning of Line)/# \$1\$2/g" /tmp/kinto/kinto.py
|
||||
perl -pi -e "s/[^\n]\s{3}(K.*)(# End of Line)/# \$1\$2/g" /tmp/kinto/kinto.py
|
||||
perl -pi -e "s/[^\n]\s{3}#\s(K.*)(# Firefox-nw)/ \$1\$2/g" /tmp/kinto/kinto.py
|
||||
perl -pi -e "s/[^\n]\s{3}(K.*)(# Beginning of Line)/ # \$1\$2/g" /tmp/kinto/kinto.py
|
||||
perl -pi -e "s/[^\n]\s{3}(K.*)(# End of Line)/ # \$1\$2/g" /tmp/kinto/kinto.py
|
||||
lastcheck=2
|
||||
ww=0
|
||||
elif [ "${check}" == "chrome ww 1" ] && [ "${lastcheck}" != 3 ]; then
|
||||
echo "chrome wordwise"
|
||||
# echo "$check"
|
||||
# Sets original config
|
||||
perl -pi -e "s/[^\n]\s{3}(K.*)(# Beginning of Line)/\$1\$2/g" /tmp/kinto/kinto.py
|
||||
perl -pi -e "s/[^\n]\s{3}(K.*)(# End of Line)/\$1\$2/g" /tmp/kinto/kinto.py
|
||||
perl -pi -e "s/[^\n]\s{3}#\s(K.*)(# Beginning of Line)/ \$1\$2/g" /tmp/kinto/kinto.py
|
||||
perl -pi -e "s/[^\n]\s{3}#\s(K.*)(# End of Line)/ \$1\$2/g" /tmp/kinto/kinto.py
|
||||
lastcheck=3
|
||||
ww=1
|
||||
elif [ "${check}" == "chrome nw" ] && [ "${lastcheck}" != 4 ]; then
|
||||
echo "chrome no wordwise"
|
||||
# echo "$check"
|
||||
# Sets new config
|
||||
perl -pi -e "s/[^\n]\s{3}#\s(K.*)(# Beginning of Line)/\$2\$3/g" /tmp/kinto/kinto.py
|
||||
perl -pi -e "s/[^\n]\s{3}#\s(K.*)(# End of Line)/\$2\$3/g" /tmp/kinto/kinto.py
|
||||
perl -pi -e "s/[^\n]\s{3}(K.*)(# Beginning of Line)/ # \$1\$2g" /tmp/kinto/kinto.py
|
||||
perl -pi -e "s/[^\n]\s{3}(K.*)(# End of Line)/ # \$1\$2/g" /tmp/kinto/kinto.py
|
||||
lastcheck=4
|
||||
ww=0
|
||||
elif [ "${check}" == "reset" ] && [ "${lastcheck}" != 5 ]; then
|
||||
echo "reset"
|
||||
# cp /home/{username}/.config/kinto/kinto.py /tmp/kinto/kinto.py
|
||||
cp /home/{username}/.config/kinto/kinto.py /tmp/kinto/kinto.py
|
||||
lastcheck=5
|
||||
fi
|
||||
# echo "outside loop $check"
|
||||
|
5
xkeysnail-config/limitedadmins
Normal file
5
xkeysnail-config/limitedadmins
Normal file
@@ -0,0 +1,5 @@
|
||||
# /etc/sudoers.d/limitedadmins
|
||||
%{username} ALL=NOPASSWD: /bin/systemctl restart xkeysnail
|
||||
%{username} ALL=NOPASSWD: /bin/systemctl start xkeysnail
|
||||
%{username} ALL=NOPASSWD: /bin/systemctl stop xkeysnail
|
||||
%{username} ALL=NOPASSWD: /bin/systemctl status xkeysnail
|
@@ -11,5 +11,6 @@ if systemctl -q --user is-enabled keyswap; then
|
||||
systemctl --user disable keyswap
|
||||
fi
|
||||
|
||||
# export DISPLAY={displayid};/usr/bin/xhost +SI:localuser:root
|
||||
mkdir -p /tmp/kinto
|
||||
cp /home/{username}/.config/kinto/kinto.py /tmp/kinto/kinto.py
|
@@ -2,7 +2,7 @@
|
||||
Name=Kinto_xkey
|
||||
GenericName=Kinto_xkey
|
||||
Comment=Make Linux Type Like it's a Mac
|
||||
Exec=/usr/bin/xhost +SI:localuser:root
|
||||
Exec=/bin/bash -c "/usr/bin/xhost +SI:localuser:root && sudo /bin/systemctl restart xkeysnail"
|
||||
Terminal=false
|
||||
Type=Application
|
||||
X-GNOME-Autostart-enabled=true
|
@@ -4,7 +4,7 @@ Description=xkeysnail
|
||||
[Service]
|
||||
Type=simple
|
||||
KillMode=process
|
||||
ExecStartPre=/sbin/runuser -l {username} -c /home/{username}/.config/kinto/prexk.sh
|
||||
ExecStartPre=/usr/bin/xhost +SI:localuser:root;/sbin/runuser -l {username} -c /home/{username}/.config/kinto/prexk.sh
|
||||
ExecStart=/usr/bin/sudo /bin/bash -c '/home/{username}/.config/kinto/xkeystart.sh "/tmp/kinto/kinto.py"'
|
||||
ExecStop=/usr/bin/sudo /usr/bin/killall xkeysnail
|
||||
Restart=on-failure
|
||||
|
@@ -35,10 +35,14 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1
|
||||
yes | cp -rf ./xkeysnail-config/xkeystart.sh ~/.config/kinto/xkeystart.sh
|
||||
yes | cp -rf ./xkeysnail-config/kinto.py ./xkeysnail-config/kinto.py.new
|
||||
yes | cp -rf ./xkeysnail-config/prexk.sh ~/.config/kinto/prexk.sh
|
||||
yes | cp -rf ./xkeysnail-config/start-xkeysnail.sh ~/.config/kinto/start-xkeysnail.sh
|
||||
yes | cp -rf ./xkeysnail-config/xkeysnail.service ./xkeysnail-config/xkeysnail.service.new
|
||||
yes | cp -rf ./xkeysnail-config/user_xkeysnail.service ~/.config/systemd/user/xkeysnail.service
|
||||
# yes | cp -rf ./xkeysnail-config/xkeysnail.timer ~/.config/systemd/user/xkeysnail.timer
|
||||
sed -i "s/{username}/`whoami`/g" ./xkeysnail-config/xkeysnail.service.new
|
||||
sed -i "s/{username}/`whoami`/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
|
||||
elif ! [[ $1 == "4" || $1 == "uninstall" ]]; then
|
||||
echo "Expected argument was not provided"
|
||||
fi
|
||||
@@ -60,7 +64,7 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1
|
||||
git clone --depth 1 https://github.com/rbreaves/xkeysnail.git
|
||||
cd xkeysnail
|
||||
sudo pip3 install --upgrade .
|
||||
sudo systemctl enable xkeysnail
|
||||
sudo systemctl enable xkeysnail.service
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl restart xkeysnail
|
||||
|
||||
@@ -86,8 +90,10 @@ elif ! [[ $1 == "4" || $1 == "uninstall" ]]; then
|
||||
else
|
||||
echo "Uninstalling Kinto - xkeysnail (udev)"
|
||||
echo '0' | sudo tee -a /sys/module/hid_apple/parameters/swap_opt_cmd;echo 'options hid_apple swap_opt_cmd=0' | sudo tee -a /etc/modprobe.d/hid_apple.conf;sudo update-initramfs -u -k all
|
||||
sudo systemctl stop xkeysnail
|
||||
sudo systemctl disable xkeysnail
|
||||
# sudo systemctl stop xkeysnail.timer
|
||||
# sudo systemctl disable xkeysnail.timer
|
||||
sudo systemctl enable xkeysnail
|
||||
sudo systemctl restart xkeysnail
|
||||
rm -rf ~/.config/kinto
|
||||
fi
|
||||
|
||||
|
Reference in New Issue
Block a user