Created
January 5, 2021 21:41
-
-
Save sl5net/b96783d4300ffd5a6f493ba2b58eb78b to your computer and use it in GitHub Desktop.
rofi stopps to this i my workaround
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from autopilot.input import Mouse | |
# mouse.click_absolute(1, 1, 1) # <== dosent work | |
mouseObj = Mouse.create() | |
x1, y1 = mouseObj.position() | |
time.sleep(.2) | |
mouseObj.move(0, 0, 0) | |
mouseObj.move(-1, 0, 0) | |
# keyboard.wait_for_keypress("<space>" , 5) # 2 second timeout | |
time.sleep(3) | |
mouseObj = Mouse.create() | |
mouseObj.move(x1, y1, 0) | |
quit() | |
# This script starts an external window manager | |
# and automatically switches to an older | |
# , previous window if no window has been changed after two seconds. | |
# its using as external window manager rofi: | |
# https://github.com/davatorium/rofi/issues/1211 | |
# https://askubuntu.com/questions/1281728/assign-shortcut-key-alttab-to-run-a-script-in-kubuntu-from-ubunto | |
# importend hints: | |
# wmctrl: | |
# https://askubuntu.com/questions/961082/command-to-switch-to-next-previous-application | |
# http://manpages.ubuntu.com/manpages/xenial/en/man1/wmctrl.1.html#examples | |
# Going to the window with a name containing 'emacs' in it | |
# wmctrl -a emacs | |
import os, subprocess, time | |
# import threading | |
def popupNotify(text): | |
subprocess.Popen(['notify-send', text]) # will be showed right top | |
# threadLock = threading.Lock() | |
# with threadLock: | |
# global_counter += 1 | |
# global counter | |
# if counter is None: | |
# counter = 1 | |
# popupNotify("1 counter = " + str(counter)) | |
# popupNotify("2 counter = " + str(counter)) | |
# popupNotify("start change window") | |
if False: | |
winTitle = window.get_active_title() # e.g. Plasma | |
winClass = window.get_active_class() # e.g. plasmashell.plasmashell | |
myCmd = '~/sh/rofi.sh &' # & this doesn't blocks! | |
os.system(myCmd) | |
time.sleep(1) | |
winTitle2 = window.get_active_title() # Plasma | |
winClass2 = window.get_active_class() # plasmashell.plasmashell | |
# following workaround dont work: | |
if False and winTitle2 == winTitle and winClass2 == winClass: | |
# keyboard.send_key("<super>+<tab>") | |
keyboard.press_key('<super>') | |
time.sleep(.2) | |
# keyboard.send_key("<tab>") | |
keyboard.press_key('<tab>') | |
time.sleep(.2) | |
keyboard.release_key('<tab>') | |
# time.sleep(.2) | |
keyboard.release_key('<super>') | |
popupNotify("not changed window") | |
# time.sleep(2) | |
# keyboard.send_key("<down>") | |
# keyboard.send_key("<down>") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment