| 1 |
|
| 2 |
|
| 3 |
import xcffib.xproto as xproto |
| 4 |
import xcffib |
| 5 |
import time |
| 6 |
|
| 7 |
conn = xcffib.connect() |
| 8 |
setup = conn.get_setup() |
| 9 |
root = setup.roots[0].root |
| 10 |
visual = setup.roots[0].root_visual |
| 11 |
depth = setup.roots[0].root_depth |
| 12 |
|
| 13 |
|
| 14 |
wid = conn.generate_id() |
| 15 |
print("Window ids are ", hex(wid)) |
| 16 |
|
| 17 |
|
| 18 |
mask = xproto.CW.BackPixel |
| 19 |
value = [ setup.roots[0].white_pixel ] |
| 20 |
conn.core.CreateWindowChecked(depth, wid, root, 0, 0, 100, 100, 0, xproto.WindowClass.InputOutput, visual, mask, value).check() |
| 21 |
|
| 22 |
name = "_NET_WM_STATE" |
| 23 |
name_atom = conn.core.InternAtom(False, len(name), name).reply().atom |
| 24 |
atom = "ATOM" |
| 25 |
atom_atom = conn.core.InternAtom(False, len(atom), atom).reply().atom |
| 26 |
fs = "_NET_WM_STATE_FULLSCREEN" |
| 27 |
fs_atom = conn.core.InternAtom(False, len(fs), fs).reply().atom |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
conn.core.MapWindowChecked(wid).check() |
| 32 |
|
| 33 |
time.sleep(0.5) |
| 34 |
|
| 35 |
|
| 36 |
conn.core.ChangePropertyChecked(xproto.PropMode.Replace, wid, name_atom, atom_atom, 32, 1, [fs_atom]).check() |
| 37 |
|
| 38 |
time.sleep(0.5) |
| 39 |
|
| 40 |
|
| 41 |
conn.core.ChangePropertyChecked(xproto.PropMode.Replace, wid, name_atom, atom_atom, 32, 0, []).check() |
| 42 |
|
| 43 |
|
| 44 |
conn.core.GetInputFocus().reply() |
| 45 |
|
| 46 |
|
| 47 |
conn.core.UnmapWindowChecked(wid).check() |
| 48 |
|
| 49 |
time.sleep(0.5) |
| 50 |
|
| 51 |
|
| 52 |
conn.core.DestroyWindowChecked(wid).check() |