當前位置: 首頁>>代碼示例>>Python>>正文


Python X.AnyPropertyType方法代碼示例

本文整理匯總了Python中Xlib.X.AnyPropertyType方法的典型用法代碼示例。如果您正苦於以下問題:Python X.AnyPropertyType方法的具體用法?Python X.AnyPropertyType怎麽用?Python X.AnyPropertyType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Xlib.X的用法示例。


在下文中一共展示了X.AnyPropertyType方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: formatWindow

# 需要導入模塊: from Xlib import X [as 別名]
# 或者: from Xlib.X import AnyPropertyType [as 別名]
def formatWindow(window):
    name = window.get_wm_name()
    info = []
    if name:
        info.append(name)

    geometry = window.get_geometry()
    info.append('%sx%sx%s at (%s,%s)' % (
        geometry.width, geometry.height, geometry.depth,
        geometry.x, geometry.y))

    atom = InternAtom(display=window.display, name="_NET_WM_PID", only_if_exists=1)
    pid = window.get_property(atom.atom, AnyPropertyType, 0, 10)
    if pid:
        pid = int(pid.value.tolist()[0])
        info.append('PID=%r' % pid)

    info.append("ID=0x%08x" % window.id)
    return '; '.join(info) 
開發者ID:tuwid,項目名稱:darkc0de-old-stuff,代碼行數:21,代碼來源:x11.py

示例2: _getProperty

# 需要導入模塊: from Xlib import X [as 別名]
# 或者: from Xlib.X import AnyPropertyType [as 別名]
def _getProperty(self, _type, win=None):
        if not win:
            win = self.root
        atom = win.get_full_property(self.display.get_atom(_type),
                                     X.AnyPropertyType)
        if atom:
            return atom.value 
開發者ID:parkouss,項目名稱:pyewmh,代碼行數:9,代碼來源:ewmh.py

示例3: _get_current_window_id

# 需要導入模塊: from Xlib import X [as 別名]
# 或者: from Xlib.X import AnyPropertyType [as 別名]
def _get_current_window_id() -> Optional[int]:
    atom = display.get_atom("_NET_ACTIVE_WINDOW")
    window_prop = screen.root.get_full_property(atom, X.AnyPropertyType)

    if window_prop is None:
        logger.warning("window_prop was None")
        return None

    # window_prop may contain more than one value, but it seems that it's always the first we want.
    # The second has in my attempts always been 0 or rubbish.
    window_id = window_prop.value[0]
    return window_id if window_id != 0 else None 
開發者ID:ActivityWatch,項目名稱:aw-watcher-window,代碼行數:14,代碼來源:xlib.py

示例4: get_window_pid

# 需要導入模塊: from Xlib import X [as 別名]
# 或者: from Xlib.X import AnyPropertyType [as 別名]
def get_window_pid(window: Window) -> str:
    atom = display.get_atom("_NET_WM_PID")
    pid_property = window.get_full_property(atom, X.AnyPropertyType)
    if pid_property:
        pid = pid_property.value[-1]
        return pid
    else:
        # TODO: Needed?
        raise Exception("pid_property was None") 
開發者ID:ActivityWatch,項目名稱:aw-watcher-window,代碼行數:11,代碼來源:xlib.py

示例5: handle_incr

# 需要導入模塊: from Xlib import X [as 別名]
# 或者: from Xlib.X import AnyPropertyType [as 別名]
def handle_incr(d, w, data_atom, target_name):
    # This works by us removing the data property, the selection owner
    # getting a notification of that, and then setting the property
    # again with more data.  To notice that, we must listen for
    # PropertyNotify events.
    w.change_attributes(event_mask = X.PropertyChangeMask)

    while True:
        # Delete data property to tell owner to give us more data
        w.delete_property(data_atom)

        # Wait for notification that we got data
        while True:
            e = d.next_event()
            if (e.type == X.PropertyNotify
                and e.state == X.PropertyNewValue
                and e.window == w
                and e.atom == data_atom):
                break

        r = w.get_full_property(data_atom, X.AnyPropertyType,
                                sizehint = 10000)

        # End of data
        if len(r.value) == 0:
            return

        output_data(d, r, target_name)
        # loop around 
開發者ID:python-xlib,項目名稱:python-xlib,代碼行數:31,代碼來源:get_selection.py

示例6: get_full_text_property

# 需要導入模塊: from Xlib import X [as 別名]
# 或者: from Xlib.X import AnyPropertyType [as 別名]
def get_full_text_property(self, property, property_type=X.AnyPropertyType, sizehint = 10):
        prop = self.get_full_property(property, property_type,
                                      sizehint=sizehint)
        if prop is None or prop.format != 8:
            return None
        if prop.property_type == Xatom.STRING:
            prop.value = prop.value.decode(self._STRING_ENCODING)
        elif prop.property_type == self.display.get_atom('UTF8_STRING'):
            prop.value = prop.value.decode(self._UTF8_STRING_ENCODING)
        # FIXME: at least basic support for compound text would be nice.
        # elif prop.property_type == self.display.get_atom('COMPOUND_TEXT'):
        return prop.value 
開發者ID:python-xlib,項目名稱:python-xlib,代碼行數:14,代碼來源:drawable.py

示例7: _getProperty

# 需要導入模塊: from Xlib import X [as 別名]
# 或者: from Xlib.X import AnyPropertyType [as 別名]
def _getProperty(self, _type, win=None):
		if not win: win = self.root
		atom = win.get_full_property(self.display.get_atom(_type), X.AnyPropertyType)
		if atom: return atom.value 
開發者ID:linuxdeepin,項目名稱:deepin-remote-assistance,代碼行數:6,代碼來源:ewmh.py


注:本文中的Xlib.X.AnyPropertyType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。