Add udev monitor

This commit is contained in:
2020-07-23 13:37:53 +09:00
parent ec36193ef9
commit a1aaa489dd
4 changed files with 42 additions and 38 deletions

View File

@@ -31,7 +31,9 @@ bspc rule -a smplayer state=floating sticky=on
# restart subscribers # restart subscribers
kill_program bspc kill_program bspc
bash $HOME/.config/bspwm/set_subscribers.sh & kill_program udevadm
$HOME/.config/bspwm/layout_monitor.sh &
$HOME/.config/bspwm/udev_monitor.sh &
# set wallpaper # set wallpaper
systemctl --user start wallpaper.timer systemctl --user start wallpaper.timer
@@ -65,20 +67,3 @@ network-manager-applet &
dex -a dex -a
libinput-gestures-setup restart libinput-gestures-setup restart
[[ -f ~/.Xmodmap ]] && xmodmap ~/.Xmodmap [[ -f ~/.Xmodmap ]] && xmodmap ~/.Xmodmap
# Elan input setting
xinput set-prop 'Elan Touchpad' 'libinput Tapping Enabled' 1
xinput set-prop 'Elan Touchpad' 'libinput Natural Scrolling Enabled' 1
xinput set-prop 'Elan TrackPoint' 'libinput Accel Speed' -0.3
# Magic Trackpad 2
xinput set-prop 'Apple Inc. Magic Trackpad 2' 'libinput Natural Scrolling Enabled' 1
xinput set-prop 'Apple Inc. Magic Trackpad 2' 'libinput Accel Speed' 0.5
# Macbook Pro Trackpad
xinput set-prop "bcm5974" "libinput Natural Scrolling Enabled" 1
xinput set-prop "bcm5974" "libinput Accel Speed" 0.5
# Logitech G402
xinput set-prop 'Logitech Gaming Mouse G402' 'libinput Accel Speed' -0.8
# Logitech G102
xinput set-prop 'Logitech G102 LIGHTSYNC Gaming Mouse' 'libinput Natural Scrolling Enabled' 1
xinput set-prop 'Logitech G102 LIGHTSYNC Gaming Mouse' 'libinput Accel Speed' -0.5

19
linux/bspwm/layout_monitor.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
bspc subscribe node_add | while read -r _ _ desktop _ node; do
num=$(bspc query -N -d $desktop | grep -f <(bspc query -N -n .leaf) | wc -l)
if [ $num = "1" ];then
xprop -id "$node" -f _PICOM_ROUNDED 32c -set _PICOM_ROUNDED 0
else
bspc query -N -d | while read -r node; do
xprop -id "$node" -remove _PICOM_ROUNDED
done
fi
done &
bspc subscribe node_remove | while read -r _ _ desktop _ node; do
num=$(bspc query -N -d $desktop | grep -f <(bspc query -N -n .leaf) | wc -l)
if [ $num = "1" ];then
bspc query -N -d | while read -r node; do
xprop -id "$node" -f _PICOM_ROUNDED 32c -set _PICOM_ROUNDED 0
done
fi
done &

View File

@@ -1,20 +0,0 @@
#!/bin/bash
bspc subscribe node_add | while read -r _ _ desktop _ node; do
num=$(bspc query -N -d $desktop | grep -f <(bspc query -N -n .leaf) | wc -l)
if [ $num = "1" ];then
xprop -id "$node" -f _PICOM_ROUNDED 32c -set _PICOM_ROUNDED 0
else
bspc query -N -d | while read -r node; do
xprop -id "$node" -remove _PICOM_ROUNDED
done
fi
done &
bspc subscribe node_remove | while read -r _ _ desktop _ node; do
num=$(bspc query -N -d $desktop | grep -f <(bspc query -N -n .leaf) | wc -l)
if [ $num = "1" ];then
bspc query -N -d | while read -r node; do
xprop -id "$node" -f _PICOM_ROUNDED 32c -set _PICOM_ROUNDED 0
done
fi
done &

20
linux/bspwm/udev_monitor.sh Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/bash
udevadm monitor -u | while read -r _ _ tag _; do
if [ "$tag" = "bind" ];then
# Elan input setting
xinput set-prop 'Elan Touchpad' 'libinput Tapping Enabled' 1
xinput set-prop 'Elan Touchpad' 'libinput Natural Scrolling Enabled' 1
xinput set-prop 'Elan TrackPoint' 'libinput Accel Speed' -0.3
# Magic Trackpad 2
xinput set-prop 'Apple Inc. Magic Trackpad 2' 'libinput Natural Scrolling Enabled' 1
xinput set-prop 'Apple Inc. Magic Trackpad 2' 'libinput Accel Speed' 0.5
# Macbook Pro Trackpad
xinput set-prop "bcm5974" "libinput Natural Scrolling Enabled" 1
xinput set-prop "bcm5974" "libinput Accel Speed" 0.5
# Logitech G402
xinput set-prop 'Logitech Gaming Mouse G402' 'libinput Accel Speed' -0.8
# Logitech G102
xinput set-prop 'Logitech G102 LIGHTSYNC Gaming Mouse' 'libinput Natural Scrolling Enabled' 1
xinput set-prop 'Logitech G102 LIGHTSYNC Gaming Mouse' 'libinput Accel Speed' -0.5
fi
done