Add script to set key repeat setting in GNOME
This commit is contained in:
parent
69398e24e2
commit
445d5d731d
15
home/.config/autostart/keyboard-repeat.desktop
Normal file
15
home/.config/autostart/keyboard-repeat.desktop
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
[Desktop Entry]
|
||||||
|
Encoding=UTF-8
|
||||||
|
Version=0.9.4
|
||||||
|
Type=Application
|
||||||
|
Name=keyboard-repeat
|
||||||
|
Comment=Sets my keyboard repeat setting in GNOME.
|
||||||
|
Icon=/usr/share/icons/Adwaita/32x32/devices/input-keyboard.png
|
||||||
|
Exec=keyboard-repeat
|
||||||
|
OnlyShowIn=GNOME
|
||||||
|
StartupNotify=false
|
||||||
|
Terminal=false
|
||||||
|
Hidden=false
|
||||||
|
|
||||||
|
Name[en_US]=keyboard-repeat
|
||||||
|
Comment[en_US]=Sets my keyboard repeat setting in GNOME.
|
33
home/bin/keyboard-repeat
Executable file
33
home/bin/keyboard-repeat
Executable file
|
@ -0,0 +1,33 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
"""
|
||||||
|
This script sets my keyboard repeat settings via `xset`, because the
|
||||||
|
GNOME Shell desktop environment doesn't give any configurable setting
|
||||||
|
to control the key repeat speed and I don't wanna fight it all the time.
|
||||||
|
|
||||||
|
I set this script to run on auto-start and set my key repeat setting.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
import os
|
||||||
|
|
||||||
|
# My settings.
|
||||||
|
settings = dict(
|
||||||
|
delay=200, # Milliseconds
|
||||||
|
rate=100, # Characters per second?
|
||||||
|
)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
# Only do this for GNOME.
|
||||||
|
current_desktop = os.environ.get("XDG_CURRENT_DESKTOP")
|
||||||
|
if current_desktop is None or current_desktop.upper() == "GNOME":
|
||||||
|
print("Setting delay to {delay} and rate {rate}".format(**settings))
|
||||||
|
subprocess.call("xset r rate {delay} {rate}".format(**settings), shell=True)
|
||||||
|
else:
|
||||||
|
subprocess.call([
|
||||||
|
"notify-send",
|
||||||
|
"-u", "critical",
|
||||||
|
"-i", "preferences-desktop-keyboard",
|
||||||
|
"keyboard-repeat: Error - Are you on GNOME? "
|
||||||
|
"I detected {}".format(current_desktop)
|
||||||
|
])
|
Loading…
Reference in New Issue
Block a user