本文整理汇总了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)
示例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
示例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
示例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")
示例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
示例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
示例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