xwrappers.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:sc-controller 作者: kozec 项目源码 文件源码
def get_current_window(dpy):
    """
    Returns active window or root window if there is no active.
    """
    # Try using WM-provided info first
    trash, prop = get_window_prop(dpy,
            get_default_root_window(dpy), "_NET_ACTIVE_WINDOW")
    if prop is not None:
        rv = cast(prop, POINTER(Atom)).contents.value
        free(prop)
        return rv

    # Fall-back to something what probably can't work anyway
    win, revert_to = XID(), c_int()
    get_input_focus(dpy, byref(win), byref(revert_to))
    if win == 0:
        return get_default_root_window(dpy)
    return win
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号