Skip to content

Instantly share code, notes, and snippets.

@OKsign
Created March 1, 2019 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OKsign/fc760f10d385aedd41781104963ba4dd to your computer and use it in GitHub Desktop.
Save OKsign/fc760f10d385aedd41781104963ba4dd to your computer and use it in GitHub Desktop.
import time
activeApp = window.get_active_class()
def kill_thonny():
time.sleep(0.2)
os.system("xdotool key Alt_L+F4")
time.sleep(0.7)
os.system("xdotool key Alt_L+n")
if 'thonny' in activeApp:
kill_thonny()
time.sleep(1)
else:
os.system("x=$(xdotool getwindowpid $(xdotool getwindowfocus));sleep 0.50;kill $x")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment