1
0

Add script to set key repeat setting in GNOME

This commit is contained in:
Noah 2016-11-23 13:52:13 -08:00
parent 69398e24e2
commit 445d5d731d
2 changed files with 48 additions and 0 deletions

View 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
View 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)
])