本文整理汇总了Python中gi.repository.GdkX11.x11_get_xatom_by_name_for_display方法的典型用法代码示例。如果您正苦于以下问题:Python GdkX11.x11_get_xatom_by_name_for_display方法的具体用法?Python GdkX11.x11_get_xatom_by_name_for_display怎么用?Python GdkX11.x11_get_xatom_by_name_for_display使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.GdkX11
的用法示例。
在下文中一共展示了GdkX11.x11_get_xatom_by_name_for_display方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_system_tray_supported
# 需要导入模块: from gi.repository import GdkX11 [as 别名]
# 或者: from gi.repository.GdkX11 import x11_get_xatom_by_name_for_display [as 别名]
def get_system_tray_supported(screen):
from gi.repository import GdkX11
try:
xlib = ctypes.CDLL('libX11.so.6')
except OSError as e:
logging.warning('Failed to load libX11: {}'.format(e))
return False
screen_num = screen.get_number()
display = screen.get_display()
xdisplay = ctypes.c_void_p(hash(display.get_xdisplay()))
xatom = ctypes.c_int(GdkX11.x11_get_xatom_by_name_for_display(display,
'_NET_SYSTEM_TRAY_S{}'.format(screen_num)))
display.grab()
ret = bool(xlib.XGetSelectionOwner(xdisplay, xatom))
display.ungrab()
xlib.XFlush(xdisplay)
return ret