tests: common: add set_window_class

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2020-04-10 16:53:13 +01:00
parent 0116912095
commit fd5c95d92a
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 10 additions and 0 deletions

View File

@ -15,6 +15,16 @@ def set_window_name(conn, wid, name):
str_type = conn.core.InternAtom(True, len(str_type), str_type).reply().atom str_type = conn.core.InternAtom(True, len(str_type), str_type).reply().atom
conn.core.ChangePropertyChecked(xproto.PropMode.Replace, wid, prop_name, str_type, 8, len(name), name).check() conn.core.ChangePropertyChecked(xproto.PropMode.Replace, wid, prop_name, str_type, 8, len(name), name).check()
def set_window_class(conn, wid, name):
if not isinstance(name, bytearray):
name = name.encode()
name = name+b"\0"+name+b"\0"
prop_name = "WM_CLASS"
prop_name = conn.core.InternAtom(False, len(prop_name), prop_name).reply().atom
str_type = "STRING"
str_type = conn.core.InternAtom(True, len(str_type), str_type).reply().atom
conn.core.ChangePropertyChecked(xproto.PropMode.Replace, wid, prop_name, str_type, 8, len(name), name).check()
def find_picom_window(conn): def find_picom_window(conn):
prop_name = "WM_NAME" prop_name = "WM_NAME"
prop_name = conn.core.InternAtom(True, len(prop_name), prop_name).reply().atom prop_name = conn.core.InternAtom(True, len(prop_name), prop_name).reply().atom