Skip to content

Instantly share code, notes, and snippets.

@OKsign
Created December 3, 2018 07:25
Show Gist options
  • Save OKsign/dce931fd9ed1894aa886083ee0d32c70 to your computer and use it in GitHub Desktop.
Save OKsign/dce931fd9ed1894aa886083ee0d32c70 to your computer and use it in GitHub Desktop.
# Don't use 'control + s' as hotkey.
# Save document '.xbindkeysrc' then relaunch xbindkeys.
import time
activeWindow = window.get_active_title()
time.sleep(0.2)
if '*.xbindkeysrc' in activeWindow:
keyboard.send_keys("<ctrl>+s")
os.system("gnome-terminal")
time.sleep(1.90)
keyboard.send_keys("killall xbindkeys")
time.sleep(0.5)
keyboard.send_keys("<enter>")
time.sleep(1.5)
keyboard.send_keys("xbindkeys")
time.sleep(0.5)
keyboard.send_keys("<enter>")
time.sleep(0.5)
keyboard.send_keys("<ctrl>+<shift>+q")
os.system("notify-send 'Script 5 for AutoKey' 'Done!'")
elif '.xbindkeysrc' in activeWindow:
keyboard.send_keys("<ctrl>+s")
os.system("gnome-terminal")
time.sleep(1.90)
keyboard.send_keys("killall xbindkeys")
time.sleep(0.5)
keyboard.send_keys("<enter>")
time.sleep(1.5)
keyboard.send_keys("xbindkeys")
time.sleep(0.5)
keyboard.send_keys("<enter>")
time.sleep(0.5)
keyboard.send_keys("<ctrl>+<shift>+q")
os.system("notify-send 'Script 5 for AutoKey' 'Done!'")
else:
os.system("notify-send 'Script 5 for AutoKey' 'Active Window is Not document .xbindkeysrc'")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment