trackpoint-toggle.sh
· 954 B · Bash
原始文件
#!/bin/bash
speed="-0.5"
trackp_enabled=$(dconf read /org/gnome/desktop/peripherals/mouse/trackpoint-toggle-on)
#cur_speed=$(dconf read /org/gnome/desktop/peripherals/mouse/speed)
if [[ "$trackp_enabled" != "'true'" ]]; then
dconf write /org/gnome/desktop/peripherals/mouse/accel-profile "'flat'"
if [[ "$cur_speed" != "$speed" ]]; then
dconf write /org/gnome/desktop/peripherals/mouse/speed -0.5
fi
dconf write /org/gnome/desktop/peripherals/mouse/trackpoint-toggle-on "'true'"
else
dconf write /org/gnome/desktop/peripherals/mouse/accel-profile "'default'"
dconf write /org/gnome/desktop/peripherals/mouse/speed 0
dconf reset /org/gnome/desktop/peripherals/mouse/trackpoint-toggle-on
fi
cur_prof=$(dconf read /org/gnome/desktop/peripherals/mouse/accel-profile)
cur_speed=$(dconf read /org/gnome/desktop/peripherals/mouse/speed)
notify-send --transient "trackpoint-toggle.sh" "Mouse speed settings changed to $cur_speed, profile $cur_prof"
1 | #!/bin/bash |
2 | |
3 | speed="-0.5" |
4 | |
5 | trackp_enabled=$(dconf read /org/gnome/desktop/peripherals/mouse/trackpoint-toggle-on) |
6 | #cur_speed=$(dconf read /org/gnome/desktop/peripherals/mouse/speed) |
7 | |
8 | if [[ "$trackp_enabled" != "'true'" ]]; then |
9 | dconf write /org/gnome/desktop/peripherals/mouse/accel-profile "'flat'" |
10 | if [[ "$cur_speed" != "$speed" ]]; then |
11 | dconf write /org/gnome/desktop/peripherals/mouse/speed -0.5 |
12 | fi |
13 | dconf write /org/gnome/desktop/peripherals/mouse/trackpoint-toggle-on "'true'" |
14 | else |
15 | dconf write /org/gnome/desktop/peripherals/mouse/accel-profile "'default'" |
16 | dconf write /org/gnome/desktop/peripherals/mouse/speed 0 |
17 | dconf reset /org/gnome/desktop/peripherals/mouse/trackpoint-toggle-on |
18 | fi |
19 | |
20 | cur_prof=$(dconf read /org/gnome/desktop/peripherals/mouse/accel-profile) |
21 | cur_speed=$(dconf read /org/gnome/desktop/peripherals/mouse/speed) |
22 | |
23 | notify-send --transient "trackpoint-toggle.sh" "Mouse speed settings changed to $cur_speed, profile $cur_prof" |