Exemplo n.º 1
0
    def select_only(self, apps):
        if isinstance(apps, list):
            for app in apps:
                if self.select(app):
                    break

        success = True
        try:
            sh.wmctrl("-x", "-a", apps)
        except sh.ErrorReturnCode:
            success = False

        return success
    def select(self, apps):
        if isinstance(apps, list):
            for app in apps:
                if self.select(app):
                    break

        success = True
        try:
            sh.wmctrl("-x", "-a", apps)
        except sh.ErrorReturnCode:
            success = False

        sh.xdotool("key", "Escape")
        return success
Exemplo n.º 3
0
 def goto_desktop(cls, desktop=None):
     if desktop is None:
         desktop = cls.desktop
     x = desktop.x * cls.work_area.width
     y = desktop.y * cls.work_area.height
     wmctrl('-o', '%s,%s' % (x, y))
Exemplo n.º 4
0
 def load(cls):
     line = wmctrl(d=True).strip().split()
     cls.full_area = cls.calculate_fa(*line[3].split('x'))
     cls.work_area = cls.calculate_wa(*(line[7].split(',') + line[8].split('x')))
     cls.desktop = cls.calculate_desktop(cls.work_area, *line[5].split(','))
Exemplo n.º 5
0
 def load(self, filename=None):
     if filename is None:
         self.windows = [Window(x) for x in wmctrl(p=True, G=True, l=True)]
     else:
         with open(filename, 'rb') as f:
             self.windows = pickle.load(f)
Exemplo n.º 6
0
 def wmctrl(self, option, args):
     # print('-i', '-r', self.id, option, ','.join(args))
     wmctrl('-i', '-r', self.id, option, ','.join(args))
Exemplo n.º 7
0
def get_window_ids():
    """
    Return a list of x11 window IDs managed by the window manager.
    """
    return [i.split(" ")[0] for i in wmctrl("-l").split("\n") if i.strip()]