Browse Source

Add script to set key repeat setting in GNOME

master
Noah Petherbridge 5 years ago
parent
commit
445d5d731d
  1. 15
      home/.config/autostart/keyboard-repeat.desktop
  2. 33
      home/bin/keyboard-repeat

15
home/.config/autostart/keyboard-repeat.desktop

@ -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

@ -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…
Cancel
Save