python - 使用 `python-xlib` 模拟 `xprop` 和 `wmctrl` 用于窗口 `above` 的函数
问题描述
我是新手python-xlib
。一年来我一直在使用gtk
, gdk
,xdotool
和. 现在我想通过.wmctrl
xprop
xlib
我有这个功能我想转换但不知道如何转换成xlib
命令。
def win_remove_above(win_hex):
""" If window 'above' (Always on Top in Ubuntu-speak) toggle it off
and return True. Otherwise return None
"""
was_above = None
all_lines = os.popen('xprop -id ' + win_hex).read().strip().splitlines()
for line in all_lines:
if "_NET_WM_STATE(ATOM)" in line:
# print('line:', line)
if "ABOVE" in line:
was_above = True
os.popen('wmctrl -ir ' + win_hex + ' -b toggle,above')
break
return was_above
解决方案
推荐阅读
- javascript - Webpack(模块构建失败)
- python-3.x - 无法迭代 multiprocessing.managers.DictProxy
- google-visualization - 如何自动设置格式化值?
- php - 在两个日期之间度过每一天
- laravel - Laravel `orWhereIn` 使 `whereNotIn` 不生效
- python - 如何在 json 中使用正则表达式匹配键
- react-native - 获取sectionlist头组件的Y值
- excel - 在 Excel 中使用 MAX IF 搜索文本段
- mongodb - 如何在 mongodb 查询中计算 avg、median、min、max?
- php - 在一个 php 文件中的两个位置打印相同的代码两次