File: ewmh.rst

package info (click to toggle)
python-ewmh 0.1.6-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 184 kB
  • sloc: python: 256; makefile: 113
file content (68 lines) | stat: -rw-r--r-- 1,395 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
======================
The ewmh python module
======================

.. automodule:: ewmh.ewmh

--------------
EWMH class
--------------

  .. autoclass:: EWMH
    :members:

--------------
Examples
--------------

These examples are tested on gnome.

Exemple to set the active window in fullscreen mode::

  from ewmh import EWMH
  ewmh = EWMH()
  
  # get the active window
  win = ewmh.getActiveWindow()
  
  # list all possible names states:
  # print EWMH.NET_WM_STATES
  
  # set the state on win
  ewmh.setWmState(win, 1, '_NET_WM_STATE_FULLSCREEN')
  
  # flush request
  ewmh.display.flush()

Exemple to move every iceweasel windows on desktop 2::

  from ewmh import EWMH
  ewmh = EWMH()
  
  # get every displayed windows
  wins = ewmh.getClientList()
  
  # get every iceweasel windows, by looking their class name:
  icewins = filter(lambda w: w.get_wm_class()[1] == 'Iceweasel', wins)
  
  # move them to desktop 2 (desktop numbering starts from 0):
  for w in icewins:
    ewmh.setWmDesktop(w, 1)
  
  # flush requests
  ewmh.display.flush()

Example trying to close every windows on desktop 2::

  from ewmh import EWMH
  ewmh = EWMH()
  
  # get every displayed windows on desktop 2:
  wins = filter(lambda w: ewmh.getWmDesktop(w) == 1, ewmh.getClientList())
  
  # trying to close them:
  for w in wins:
    ewmh.setCloseWindow(w)
  
  # flush requests
  ewmh.display.flush()