def __remove_closed_windows(self): try: windows = Window.list() open_windows = [] for window in windows: open_windows.append(window[0]) for key in self.original_window_sizes.keys(): if key not in open_windows: self.__remove_window(key) except ValueError: #catching Error in the wmctrl function list(), still holding already closed windows pass
def main_emergency(): for win in Window.list(): if win.wm_class != 'plasmashell.plasmashell': win.move(0, 0)
def test_list(): xclock = Apps.get_xclock() wins = Window.list() names = [win.wm_name for win in wins] assert xclock.NAME in names
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
import os.path import time import pyautogui from subprocess import call from wmctrl import Window for win in Window.list(): print(win) # For ubuntu 16 # zap_main = Window.by_class('sun-awt-X11-XFramePeer.OWASP')[0] zap_main = Window.by_class('OWASP')[0] zap_main.set_properties(['add', 'maximized_vert', 'maximized_horz']) pyautogui.screenshot('output/shot.png') screenWidth, screenHeight = pyautogui.size() currentMouseX, currentMouseY = pyautogui.position() # pyautogui.moveRel(None, 10) # move mouse 10 pixels down # pyautogui.doubleClick() # Mac force to start # pyautogui.hotkey('command', 'space') # pyautogui.typewrite('OWASP ZAP', interval=0.01) # pyautogui.press('enter') # Quick launch pyautogui.moveTo(890, 94, duration=0.6) pyautogui.click() time.sleep(4) pyautogui.hotkey('esc')
def __init__(self): self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.show() print Window.list() self.window.connect("delete_event", self.delete_event) self.window.connect("destroy", self.destroy)