Dernière activité 1710225480

Quick script to toggle between a profile suitable for trackpoint and a regular mouse in GNOME

jarno's Avatar jarno a révisé ce gist 1710225480. Aller à la révision

1 file changed, 2 insertions, 4 deletions

trackpoint-toggle.sh

@@ -3,13 +3,11 @@
3 3 speed="-0.5"
4 4
5 5 trackp_enabled=$(dconf read /org/gnome/desktop/peripherals/mouse/trackpoint-toggle-on)
6 - cur_speed=$(dconf read /org/gnome/desktop/peripherals/mouse/speed)
6 + #cur_speed=$(dconf read /org/gnome/desktop/peripherals/mouse/speed)
7 7
8 8 if [[ "$trackp_enabled" != "'true'" ]]; then
9 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
10 + dconf write /org/gnome/desktop/peripherals/mouse/speed $speed
13 11 dconf write /org/gnome/desktop/peripherals/mouse/trackpoint-toggle-on "'true'"
14 12 else
15 13 dconf write /org/gnome/desktop/peripherals/mouse/accel-profile "'default'"

jarno's Avatar jarno a révisé ce gist 1710225410. Aller à la révision

1 file changed, 1 insertion, 1 deletion

trackpoint-toggle.sh

@@ -3,7 +3,7 @@
3 3 speed="-0.5"
4 4
5 5 trackp_enabled=$(dconf read /org/gnome/desktop/peripherals/mouse/trackpoint-toggle-on)
6 - #cur_speed=$(dconf read /org/gnome/desktop/peripherals/mouse/speed)
6 + cur_speed=$(dconf read /org/gnome/desktop/peripherals/mouse/speed)
7 7
8 8 if [[ "$trackp_enabled" != "'true'" ]]; then
9 9 dconf write /org/gnome/desktop/peripherals/mouse/accel-profile "'flat'"

jarno's Avatar jarno a révisé ce gist 1710225385. Aller à la révision

1 file changed, 5 insertions, 3 deletions

trackpoint-toggle.sh

@@ -2,17 +2,19 @@
2 2
3 3 speed="-0.5"
4 4
5 - cur_prof=$(dconf read /org/gnome/desktop/peripherals/mouse/accel-profile)
6 - cur_speed=$(dconf read /org/gnome/desktop/peripherals/mouse/speed)
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 7
8 - if [[ "$cur_prof" != "'flat'" ]]; then
8 + if [[ "$trackp_enabled" != "'true'" ]]; then
9 9 dconf write /org/gnome/desktop/peripherals/mouse/accel-profile "'flat'"
10 10 if [[ "$cur_speed" != "$speed" ]]; then
11 11 dconf write /org/gnome/desktop/peripherals/mouse/speed -0.5
12 12 fi
13 + dconf write /org/gnome/desktop/peripherals/mouse/trackpoint-toggle-on "'true'"
13 14 else
14 15 dconf write /org/gnome/desktop/peripherals/mouse/accel-profile "'default'"
15 16 dconf write /org/gnome/desktop/peripherals/mouse/speed 0
17 + dconf reset /org/gnome/desktop/peripherals/mouse/trackpoint-toggle-on
16 18 fi
17 19
18 20 cur_prof=$(dconf read /org/gnome/desktop/peripherals/mouse/accel-profile)

jarno's Avatar jarno a révisé ce gist 1710225186. Aller à la révision

1 file changed, 7 insertions, 9 deletions

trackpoint-toggle.sh

@@ -5,16 +5,14 @@ speed="-0.5"
5 5 cur_prof=$(dconf read /org/gnome/desktop/peripherals/mouse/accel-profile)
6 6 cur_speed=$(dconf read /org/gnome/desktop/peripherals/mouse/speed)
7 7
8 - if [[ "$cur_prof" == "'default'" ]]; then
9 - dconf write /org/gnome/desktop/peripherals/mouse/accel-profile "'flat'"
8 + if [[ "$cur_prof" != "'flat'" ]]; 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
10 13 else
11 - dconf write /org/gnome/desktop/peripherals/mouse/accel-profile "'default'"
12 - fi
13 -
14 - if [[ "$cur_speed" != "$speed" ]]; then
15 - dconf write /org/gnome/desktop/peripherals/mouse/speed -0.5
16 - else
17 - dconf write /org/gnome/desktop/peripherals/mouse/speed 0
14 + dconf write /org/gnome/desktop/peripherals/mouse/accel-profile "'default'"
15 + dconf write /org/gnome/desktop/peripherals/mouse/speed 0
18 16 fi
19 17
20 18 cur_prof=$(dconf read /org/gnome/desktop/peripherals/mouse/accel-profile)

jarno's Avatar jarno a révisé ce gist 1707812686. Aller à la révision

1 file changed, 1 insertion, 1 deletion

trackpoint-toggle.sh

@@ -20,4 +20,4 @@ fi
20 20 cur_prof=$(dconf read /org/gnome/desktop/peripherals/mouse/accel-profile)
21 21 cur_speed=$(dconf read /org/gnome/desktop/peripherals/mouse/speed)
22 22
23 - notify-send "Mouse speed settings changed to $cur_speed, profile $cur_prof"
23 + notify-send --transient "trackpoint-toggle.sh" "Mouse speed settings changed to $cur_speed, profile $cur_prof"

jarno's Avatar jarno a révisé ce gist 1707812406. Aller à la révision

1 file changed, 23 insertions

trackpoint-toggle.sh(fichier créé)

@@ -0,0 +1,23 @@
1 + #!/bin/bash
2 +
3 + speed="-0.5"
4 +
5 + cur_prof=$(dconf read /org/gnome/desktop/peripherals/mouse/accel-profile)
6 + cur_speed=$(dconf read /org/gnome/desktop/peripherals/mouse/speed)
7 +
8 + if [[ "$cur_prof" == "'default'" ]]; then
9 + dconf write /org/gnome/desktop/peripherals/mouse/accel-profile "'flat'"
10 + else
11 + dconf write /org/gnome/desktop/peripherals/mouse/accel-profile "'default'"
12 + fi
13 +
14 + if [[ "$cur_speed" != "$speed" ]]; then
15 + dconf write /org/gnome/desktop/peripherals/mouse/speed -0.5
16 + else
17 + dconf write /org/gnome/desktop/peripherals/mouse/speed 0
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 "Mouse speed settings changed to $cur_speed, profile $cur_prof"
Plus récent Plus ancien