def test_activate(): orig = Window.get_active() win, xfontsel = get_win('xfontsel', '-geometry', '+0+0') win.activate() time.sleep(0.5) active = Window.get_active() assert active.id == win.id orig.activate() time.sleep(0.5) active = Window.get_active() assert active.id == orig.id
def __get_active_window(self): try: window = Window.get_active() return window except ValueError: #catching Error in the wmctrl function list(), still holding already closed windows return None
def run_analysis(): try: print("run in maximized window to get values for screen width and height") window = Window.get_active() return window.w, window.h except ValueError: #catching Error in the wmctrl function list(), still holding already closed windows return None
def test_Desktop_active(): desktop = Desktop.get_active() win = Window.get_active() assert win.desktop == desktop.num
def move(self): if Window.get_active().id != MAIN_WINDOW.id: print >> sys.stderr, 'Lost focus, exiting' sys.exit(1) autopy.mouse.move(*self)
def save_my_window_id(self, rrun_file): writefile(rrun_file, Window.get_active().id)
def getStrings(): stdscr.clear() windows = W.list() keys = ["f", "j", "d", "k", "s", "l", "a"] # keys to chose the window keyComb = [] # generate a key Combination for each window if (len(keys) < len(windows)): count = 0 isBreak = False for i in keys: for j in keys: if (count == len(windows)): break isBreak = True keyComb.append(i + j) count += 1 if isBreak: break else: keyComb = keys[0:len(windows)] actice = W.get_active() # dont show this program count = 0 for win in windows: if win == actice: del windows[count] break count += 1 windowNames = [] # get the correct name for programs in terminals for win in windows: name = win.wm_name pids = [win.pid] if (name == "termite"): # TODO make it portable for other terminals pids = psutil.Process(pids[0]).children() if (len(pids) > 0): name = pids[0].name() if (name == "zsh"): # TODO make it portable for other shells pids = pids[0].children() if (len(pids) > 0): name = pids[0].name() windowNames.append(name) ws = [x.desktop for x in windows] windowNumber = [0] * (max(ws) + 1) for i in (ws): windowNumber[i] += 1 count = 0 countL = 0 countWs = 0 for i in windowNumber: # print the lines if (i % 2 == 0): middle = (i / 2) else: middle = ((i + 1) / 2) for j in range(i): if (j == middle - 1): stdscr.addstr( countL, 0, str(countWs) + "| [" + keyComb[count] + "]: " + windowNames[count]) else: stdscr.addstr( countL, 0, " | [" + keyComb[count] + "]: " + windowNames[count]) count += 1 countL += 1 if (i != 0): countL += 1 # print a empty line between workspaces countWs += 1 stdscr.refresh() return keyComb, [x.id for x in windows], ws