Skip to content

Instantly share code, notes, and snippets.

@OKsign
Created June 17, 2019 16:32
Show Gist options
  • Save OKsign/783c5e5b8d7ad4e107f78aa3aac35e81 to your computer and use it in GitHub Desktop.
Save OKsign/783c5e5b8d7ad4e107f78aa3aac35e81 to your computer and use it in GitHub Desktop.
# apps: Xclip, Xdotool, Zenity
import time
choose1 = "zenity --entry --title='Input' --text='Mouse = 1, Size and Position of Window = 2, Activate App = 3'"
user_choose1 = system.exec_command(choose1)
if user_choose1 is '2':
time.sleep(1.5)
mousepos = system.exec_command("eval $(xdotool getmouselocation --shell); echo $X $Y")
sizepos = "eval $(xdotool getwindowfocus getwindowgeometry --shell); echo 'time.sleep(0.7)''\nos.system(\"xdotool key alt+F5\")''\ntime.sleep(0.7)''\nos.system(\"xdotool windowsize $(xdotool getwindowfocus)' $WIDTH $HEIGHT'\")''\ntime.sleep(0.7)''\nos.system(\"xdotool windowmove $(xdotool getwindowfocus) %s\")' | xclip -selection clipboard" % mousepos
system.exec_command(sizepos)
time.sleep(0.5)
os.system("notify-send 'Script 12.4 for AutoKey' 'Done!'")
if user_choose1 is '1':
command1 = "zenity --entry --title='Input' --text='xy position = 0, Left Click = 1, Middle Click = 2, Right Click = 3'"
user_input = system.exec_command(command1)
if user_input is '0':
writeclip = "eval $(xdotool getmouselocation --shell); echo $X $Y | xclip -selection clipboard"
system.exec_command(writeclip)
time.sleep(0.5)
os.system("notify-send 'Script 12.4 for AutoKey' 'Done!'")
if user_input is '1':
writeclip = "eval $(xdotool getmouselocation --shell); echo 'os.system(\"xdotool mousemove '$X $Y 'click 1\") # left click' | xclip -selection clipboard"
system.exec_command(writeclip)
time.sleep(0.5)
os.system("notify-send 'Script 12.4 for AutoKey' 'Done!'")
if user_input is '2':
writeclip = "eval $(xdotool getmouselocation --shell); echo 'os.system(\"xdotool mousemove '$X $Y 'click 2\") # middle click' | xclip -selection clipboard"
system.exec_command(writeclip)
time.sleep(0.5)
os.system("notify-send 'Script 12.4 for AutoKey' 'Done!'")
if user_input is '3':
writeclip = "eval $(xdotool getmouselocation --shell); echo 'os.system(\"xdotool mousemove '$X $Y 'click 3\") # right click' | xclip -selection clipboard"
system.exec_command(writeclip)
time.sleep(0.5)
os.system("notify-send 'Script 12.4 for AutoKey' 'Done!'")
if user_choose1 is '3':
time.sleep(1)
winClass = window.get_active_class()
time.sleep(0.5)
splitva = [x.strip() for x in winClass.split('.')]
valueClass = splitva[1]
time.sleep(0.5)
system.exec_command("echo 'os.system(\"xdotool search --onlyvisible --class %s | xargs -n 1 xdotool windowactivate\")''\ntime.sleep(1)' | xclip -sel clip" % valueClass)
time.sleep(0.5)
os.system("notify-send 'Script 12.4 for AutoKey' 'Done!'")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment