aboutsummaryrefslogtreecommitdiff
path: root/.config/awesome/xinput-daemon.sh
diff options
context:
space:
mode:
authorBlista Kanjo2023-06-15 22:29:23 -0400
committerBlista Kanjo2023-06-15 22:29:23 -0400
commit96e6bbeb73821f8f88802317fc4fa8af7a88fa25 (patch)
treeb40b980b6322fd789fb8b79dcff8281355ac00dd /.config/awesome/xinput-daemon.sh
parente7fef1b6e106663c43735ad7639ea99f8bf7c138 (diff)
refactor: cleaner xinput-daemon
Diffstat (limited to '.config/awesome/xinput-daemon.sh')
-rwxr-xr-x.config/awesome/xinput-daemon.sh22
1 files changed, 17 insertions, 5 deletions
diff --git a/.config/awesome/xinput-daemon.sh b/.config/awesome/xinput-daemon.sh
index 959ab72..3ede3fc 100755
--- a/.config/awesome/xinput-daemon.sh
+++ b/.config/awesome/xinput-daemon.sh
@@ -1,17 +1,29 @@
#!/bin/sh
-
-apply_settings () {
-
+# Function to apply the desired settings
+apply_settings() {
sleep 2
xinput set-prop pointer:"Logitech USB Trackball" "libinput Natural Scrolling Enabled" 1
xinput set-prop pointer:"Logitech USB Trackball" "libinput Accel Speed" 1.000000
xinput set-prop pointer:"SteelSeries SteelSeries Rival 310 eSports Mouse" "libinput Accel Speed" 0.300000
xinput set-prop pointer:"ELECOM ELECOM TrackBall Mouse" "libinput Accel Speed" 0.300000
xinput set-prop pointer:"Logitech M705" "libinput Accel Speed" 1.000000
-
}
+# Initial application of settings
apply_settings
-while true; do state=$(lsusb) && sleep 2 && [ "$state" != "$(lsusb)" ] && apply_settings; done
+# Continuously monitor for changes in USB devices and reapply settings if any change is detected
+while true; do
+ # Get the current state of USB devices
+ state=$(lsusb)
+
+ # Wait for 2 seconds
+ sleep 2
+
+ # Compare the current state with the new state of USB devices
+ # If any change is detected, reapply the settings
+ if [ "$state" != "$(lsusb)" ]; then
+ apply_settings
+ fi
+done