local/bin: Add update-keyboard-layout script

This commit is contained in:
xerus2000 2020-10-13 11:41:47 +02:00
parent 65cd6e71cb
commit d8bbdd46c8
3 changed files with 10 additions and 3 deletions

View File

@ -16,9 +16,10 @@ sudo sed -i 's/#HandleLidSwitch=suspend/HandleLidSwitch=ignore/' /etc/systemd/lo
# Fix Chrysalis for keyboardio - https://github.com/keyboardio/Chrysalis/wiki/Troubleshooting
if test ! -f /etc/udev/rules.d/keyboardio.rules; then
echo 'SUBSYSTEM=="tty", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="230[0-3]", SYMLINK+="model01", TAG+="seat", TAG+="uaccess", RUN+="/home/janek/.local/bin/update-keyboard-layout.sh"' | sudo tee /etc/udev/rules.d/keyboardio.rules
echo 'SUBSYSTEM=="tty", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="230[0-3]", SYMLINK+="model01", TAG+="seat", TAG+="uaccess", RUN+="'"$HOME/.local/bin/update-keyboard-layout\"" | sudo tee /etc/udev/rules.d/keyboardio.rules
sudo udevadm control -R
sudo udevadm trigger -v /dev/ttyACM0
#sudo systemctl disable ModemManager
fi
@ -44,7 +45,7 @@ echo "@reboot root $(which iptables-restore) < /etc/iptables.rules" | sudo tee /
# Workrave
sudo sed -i 's|Exec=workrave|Exec=sh -c "workrave \& sleep 1; dbus-send --session --dest=org.workrave.Workrave --type=method_call /org/workrave/Workrave/Core org.workrave.CoreInterface.SetOperationMode string:normal"|' /usr/share/applications/workrave.desktop
ln -sfv /usr/share/applications/workrave.desktop $XDG_CONFIG_HOME/autostart
echo " 0,20,40 * * * * janek pgrep workrave || XAUTHORITY='$HOME/.Xauthority' DISPLAY=:0 /usr/bin/workrave" | sudo tee /etc/cron.d/workrave
echo " 0,20,40 * * * * janek pgrep workrave || XAUTHORITY='$XDG_CACHE_HOME/Xauthority' DISPLAY=:0 /usr/bin/workrave" | sudo tee /etc/cron.d/workrave
# Cron logging
echo 'cron.* /var/log/cron.log' | sudo tee /etc/rsyslog.d/60-cron.conf

View File

@ -0,0 +1,6 @@
#!/bin/sh
test "$ACTION" && case $ACTION in
add) id=1;;
remove) id=0;;
esac || id=$(test -c /dev/ttyACM0 && echo 1 || echo 0)
test "$id" && XAUTHORITY="/home/janek/.cache/Xauthority" DISPLAY=:0 xkblayout-state set $id

View File

@ -31,4 +31,4 @@ export CTEST_OUTPUT_ON_FAILURE=1
export CTEST_PARALLEL_LEVEL=3
# Update keyboard layout to US if keyboardio is connected
$HOME/.local/bin/update-keyboard-layout.sh
$HOME/.local/bin/update-keyboard-layout