Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sl5net/2f08d2ac3458dbcc81141132dcc398ed to your computer and use it in GitHub Desktop.
Save sl5net/2f08d2ac3458dbcc81141132dcc398ed to your computer and use it in GitHub Desktop.
# autokey-gtk.Autokey-gtk.AutoKey
import os, time, subprocess
def popupNotify(text):
subprocess.Popen(['notify-send', text]) # will be showed right top
# path = home + "/.config/autokey/data/Sample Scripts/"
def beeps(duration=.1, freq=2000, loops=1):
# duration = .8 # second # freq = 1500 # Hz
for x in range(loops):
os.system('play --no-show-progress --null --channels 1 synth %s sine %f' % (duration, freq))
offset = 0
if False: # not able to start copyQ like so:
keyboard.press_key('<ctrl>')
time.sleep(.5)
keyboard.send_keys("<ctrl>+^°") # ü
keyboard.release_key('<ctrl>')
beeps(duration=.1, freq=2000, loops=2)
quit()
# else:
# copyq show
# myCmd = 'copyq show'
# os.system(myCmd)
# time.sleep(.5)
# beeps(duration=.1, freq=2000, loops=2)
# quit()
# winClass = window.get_active_class()
#
#commandToRun=dialog.input_dialog(title="Terminal Command", message='', default='ls')
# reported here: https://github.com/hluk/CopyQ/issues/153#issuecomment-728917572
winTitle = window.get_active_title()
ok, text = dialog.input_dialog("Line ", "Choose line number ", default='10')
time.sleep(.1)
if winTitle != "AutoKey":
myCmd = 'copyq select ' + text # works :)
os.system(myCmd)
keyboard.send_keys("<ctrl>+v")
quit()
# myCmd = 'copyq show' # works it shows copyQ
# myCmd = 'copyq edit ROW=' + text # works not <= it show always the same
keyboard.send_keys("<ctrl>+<home>")
# window.wait_for_focus("Linwe down", timeOut=5)
# keyboard.send_keys(str(text))
#
keyboard.send_keys("<ctrl>+<home>") # ü
for i in range(0, int(text)-1+offset):
keyboard.press_key('<down>')
keyboard.release_key('<down>')
# 558
beeps(duration=.1, freq=2000, loops=1)
# popupNotify("1")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment