예제 #1
0
def set_border_color():
    """
    Get active window and set border color
    if the _QUBES_LABEL value has changed
    """
    global current_qlabel

    qlabel = 0

    activewin = ewmh.get_active_window().reply()
    if not activewin:
        return

    try:
        prop = util.PropertyCookie(util.get_property(activewin,
                                                     '_QUBES_LABEL')).reply()
    except:
        return
    if prop is not None:
        qlabel = ord(prop)

    if qlabel != current_qlabel:
        color = COLORS.get(qlabel)
        call(["bspc", "config", "focused_border_color", color])
        current_qlabel = qlabel

    xpybutil.conn.flush()
def set_border_color():
    """
    Get active window and set border color
    if the _QUBES_LABEL value has changed
    """
    global current_qlabel

    qlabel = 0

    activewin = ewmh.get_active_window().reply()
    if not activewin:
        return

    try:
        prop = util.PropertyCookie(util.get_property(
            activewin, '_QUBES_LABEL')).reply()
    except:
        return
    if prop is not None:
        qlabel = ord(prop)

    if qlabel != current_qlabel:
        color = COLORS.get(qlabel)
        call(["bspc", "config", "focused_border_color", color])
        current_qlabel = qlabel

    xpybutil.conn.flush()
예제 #3
0
 def get_deepin_window_shadow_width(self, winId):
     '''@process shadow value for deepin-ui window.'''
     window_shadow = get_property(winId, "DEEPIN_WINDOW_SHADOW")
     deepin_window_shadow_value = get_property_value(window_shadow.reply())
     if deepin_window_shadow_value:
         deepin_window_shadow_width = int(deepin_window_shadow_value)
     else:
         deepin_window_shadow_width = 0
     return deepin_window_shadow_width
예제 #4
0
 def get_deepin_window_shadow_width(self, winId):
     '''@process shadow value for deepin-ui window.'''
     window_shadow = get_property(winId, "DEEPIN_WINDOW_SHADOW")
     deepin_window_shadow_value = get_property_value(window_shadow.reply())
     if deepin_window_shadow_value:
         deepin_window_shadow_width = int(deepin_window_shadow_value)
     else:
         deepin_window_shadow_width = 0
     return deepin_window_shadow_width
예제 #5
0
 def get_gtk_window_frame_extents(self, winId):
     '''@process frame for gtk window.'''
     window_frame_extents = get_property(winId, "_GTK_FRAME_EXTENTS")
     window_frame_rect = get_property_value(window_frame_extents.reply())
     if window_frame_rect:
         return [window_frame_rect[0], window_frame_rect[1],
         window_frame_rect[2], window_frame_rect[3]]
     else:
         return [0, 0, 0, 0]
예제 #6
0
 def get_gtk_window_frame_extents(self, winId):
     '''@process frame for gtk window.'''
     window_frame_extents = get_property(winId, "_GTK_FRAME_EXTENTS")
     window_frame_rect = get_property_value(window_frame_extents.reply())
     if window_frame_rect:
         return [
             window_frame_rect[0], window_frame_rect[1],
             window_frame_rect[2], window_frame_rect[3]
         ]
     else:
         return [0, 0, 0, 0]
예제 #7
0
파일: client.py 프로젝트: sahwar/pyndow
    def is_in_timeout(self):
        cookie = util.get_property(state.conn, self.win.id,
                                   aid('_PYNDOW_CMD_TIMEOUT'))
        check = util.PropertyCookieSingle(cookie).reply()

        if check is None:
            return False

        check = int(check)

        return check == 1
예제 #8
0
    def get_windows_info(self):
        '''
        @return: all windows' coordinate in this workspace
        @rtype: a list, each in the list is a tuple which containing x and y and width and height
        '''
        screenshot_window_info = []
        self.wnck_screen.force_update()
        win_list = self.wnck_screen.get_windows_stacked()
        self.wnck_workspace = self.wnck_screen.get_active_workspace()
        if not self.wnck_workspace:      # there is no active workspace in some wm.
            self.wnck_workspace = self.wnck_screen.get_workspaces()[0]
        for w in win_list:
            if not w.is_on_workspace(self.wnck_workspace):
                continue
            try:    # some environment has not WINDOW_STATE_MINIMIZED property
                if w.get_state() & wnck.WINDOW_STATE_MINIMIZED or\
                        w.get_state() & wnck.WINDOW_STATE_HIDDEN or\
                        w.get_window_type() == wnck.WINDOW_DESKTOP:
                    continue
            except:
                pass
            (x, y, width, height) = w.get_geometry()                # with frame

            # Get shadow value for deepin-ui window.
            cookie = get_property(w.get_xid(), "DEEPIN_WINDOW_SHADOW")
            deepin_window_shadow_value = get_property_value(cookie.reply())
            if deepin_window_shadow_value:
                deepin_window_shadow_size = int(deepin_window_shadow_value)
            else:
                deepin_window_shadow_size = 0

            if w.get_window_type() == wnck.WINDOW_DOCK and\
                    width >= self.screen_width and height >= self.screen_height:
                continue

            (wx, wy, ww, wh) = self.convert_coord(
                x + deepin_window_shadow_size,
                y + deepin_window_shadow_size,
                width - deepin_window_shadow_size * 2,
                height - deepin_window_shadow_size * 2)

            if ww != 0 and wh != 0:
              screenshot_window_info.insert(0, (wx, wy, ww, wh))
        return screenshot_window_info
예제 #9
0
    def get_windows_info(self):
        '''
        @return: all windows' coordinate in this workspace
        @rtype: a list, each in the list is a tuple which containing x and y and width and height
        '''
        screenshot_window_info = []
        self.wnck_screen.force_update()
        win_list = self.wnck_screen.get_windows_stacked()
        self.wnck_workspace = self.wnck_screen.get_active_workspace()
        if not self.wnck_workspace:  # there is no active workspace in some wm.
            self.wnck_workspace = self.wnck_screen.get_workspaces()[0]
        for w in win_list:
            if not w.is_on_workspace(self.wnck_workspace):
                continue
            try:  # some environment has not WINDOW_STATE_MINIMIZED property
                if w.get_state() & wnck.WINDOW_STATE_MINIMIZED or\
                        w.get_state() & wnck.WINDOW_STATE_HIDDEN or\
                        w.get_window_type() == wnck.WINDOW_DESKTOP:
                    continue
            except:
                pass
            (x, y, width, height) = w.get_geometry()  # with frame

            # Get shadow value for deepin-ui window.
            cookie = get_property(w.get_xid(), "DEEPIN_WINDOW_SHADOW")
            deepin_window_shadow_value = get_property_value(cookie.reply())
            if deepin_window_shadow_value:
                deepin_window_shadow_size = int(deepin_window_shadow_value)
            else:
                deepin_window_shadow_size = 0

            if w.get_window_type() == wnck.WINDOW_DOCK and\
                    width >= self.screen_width and height >= self.screen_height:
                continue

            (wx, wy, ww,
             wh) = self.convert_coord(x + deepin_window_shadow_size,
                                      y + deepin_window_shadow_size,
                                      width - deepin_window_shadow_size * 2,
                                      height - deepin_window_shadow_size * 2)

            if ww != 0 and wh != 0:
                screenshot_window_info.insert(0, (wx, wy, ww, wh))
        return screenshot_window_info
예제 #10
0
def cli():
    ARGS = sys.argv[1:]
    bus = SessionBus()
    rofi_bus = bus.get('pro.wizardsoftheweb.pyrofibus')

    if ARGS and ARGS[0]:
        rofi_bus.ActivateWindow(int(ARGS[0].split(' ')[-1]))
        exit(0)

    window_ids = rofi_bus.GetWindowList()
    desktops = get_desktop_names().reply()
    items = []
    max_desktop = 0
    max_class = 0
    max_name = 0
    for window_id in window_ids:
        new_item = [
            desktops[get_wm_desktop(window_id).reply()],
            get_property(
                window_id,
                'WM_CLASS').reply().value.to_string().split('\x00')[1],
            get_wm_name(window_id).reply().encode('utf-8'),
            window_id,
        ]
        max_desktop = len(
            new_item[0]) if len(new_item[0]) > max_desktop else max_desktop
        max_class = len(
            new_item[1]) if len(new_item[1]) > max_class else max_class
        max_name = len(
            new_item[2]) if len(new_item[2]) > max_name else max_name
        items.append(new_item)
    items.append(items.pop(0))

    for item in items:
        print("{:{max_desktop}} {:{max_class}} {:{max_name}} {}".format(
            *item,
            max_desktop=max_desktop + 2,
            max_class=max_class + 2,
            max_name=max_name))
예제 #11
0
def get_wm_hints(window):
    return HintsCookie(util.get_property(window, atoms.WM_HINTS))
예제 #12
0
def get_wm_normal_hints(window):
    return NormalHintsCookie(util.get_property(window, atoms.WM_NORMAL_HINTS))
예제 #13
0
def get_wm_class(window):
    return util.PropertyCookie(util.get_property(window, atoms.WM_CLASS))
 def get_rofi_window_role(window_id):
     return get_property(window_id, 'WM_WINDOW_ROLE')\
         .reply()\
         .value\
         .to_string()
예제 #15
0
def get_wm_state(window):
    return StateCookie(util.get_property(window, "WM_STATE"))
예제 #16
0
def get_wm_client_machine(window):
    return util.PropertyCookie(
        util.get_property(window, atoms.WM_CLIENT_MACHINE))
예제 #17
0
def get_wm_protocols(window):
    return util.PropertyCookie(util.get_property(window, "WM_PROTOCOLS"))
예제 #18
0
def get_icon_size(window):
    return IconSizeCookie(util.get_property(window, atoms.WM_ICON_SIZE))
예제 #19
0
def get_wm_state(window):
    return StateCookie(util.get_property(window, 'WM_STATE'))
예제 #20
0
def get_wm_client_machine(window):
    return util.PropertyCookie(util.get_property(window,
                                                 atoms.WM_CLIENT_MACHINE))
예제 #21
0
def get_wm_colormap_windows(window):
    return util.PropertyCookie(util.get_property(window, 'WM_COLORMAP_WINDOWS'))
예제 #22
0
def get_wm_protocols(window):
    return util.PropertyCookie(util.get_property(window, 'WM_PROTOCOLS'))
예제 #23
0
def get_wm_transient_for(window):
    return util.PropertyCookie(util.get_property(window,
                                                 atoms.WM_TRANSIENT_FOR))
예제 #24
0
def get_wm_class(window):
    return util.PropertyCookie(util.get_property(window, atoms.WM_CLASS))
예제 #25
0
def get_wm_transient_for(window):
    return util.PropertyCookie(
        util.get_property(window, atoms.WM_TRANSIENT_FOR))
예제 #26
0
def get_wm_normal_hints(window):
    return NormalHintsCookie(util.get_property(window, atoms.WM_NORMAL_HINTS))
예제 #27
0
def get_wm_colormap_windows(window):
    return util.PropertyCookie(util.get_property(window,
                                                 "WM_COLORMAP_WINDOWS"))
예제 #28
0
def get_hints(window):
    return MotifHintsCookie(util.get_property(window, '_MOTIF_WM_HINTS'))
예제 #29
0
def get_wm_name(window):
    return util.PropertyCookie(util.get_property(window, atoms.WM_NAME))
예제 #30
0
파일: motif.py 프로젝트: inktrap/xpybutil
def get_hints(window):
    return MotifHintsCookie(util.get_property(window, "_MOTIF_WM_HINTS"))
예제 #31
0
def get_icon_size(window):
    return IconSizeCookie(util.get_property(window, atoms.WM_ICON_SIZE))
 def get_rofi_window_name(window_id):
     return get_property(window_id, 'WM_CLASS')\
         .reply()\
         .value\
         .to_string()\
         .split('\x00')[0]
예제 #33
0
def get_wm_icon_name(window):
    return util.PropertyCookie(util.get_property(window, atoms.WM_ICON_NAME))
예제 #34
0
def get_wm_hints(window):
    return HintsCookie(util.get_property(window, atoms.WM_HINTS))