Core orcsome instance
Can be get in any time as:
import orcsome
wm = orcsome.get_wm()
Activate window desktop
Return:
Move window to desktop
Send request to wm to close window
Return current desktop number
Counts from zero.
Return currently active (with input focus) window
Decorate/undecorate window
Parameters: | decorate – undecorate window if False |
---|
Note
Openbox specific.
Return first matching client
Parameters: |
|
---|
Return matching clients list
Parameters: |
|
---|
Activate window desktop, set input focus and raise it
Activate window
Return atom value
Return atom string representation
Return wm client list
Return client list in stacked order.
Most top window will be last in list. Can be useful to determine window visibility.
Return window desktop.
Result is:
Return WM_WINDOW_ROLE property
Return WindowState instance
Return _NET_WM_NAME property
Check if window suits given matchers.
Matchers keyword arguments are used in on_create(), spawn_or_raise(). find_clients() and find_client().
name, cls, title and role can be regular expressions.
Signal decorator to handle window creation
Can be used in two forms. Listen to any window creation:
@wm.on_create
def debug(wm):
print wm.event_window.get_wm_class()
Or specific window:
@wm.on_create(cls='Opera')
def use_firefox_luke(wm):
wm.close_window(wm.event_window)
spawn('firefox')()
Also, orcsome calls on_create handlers on its startup. You can check wm.startup attribute to denote such event.
See is_match() for **matchers argument description.
Signal decorator to handle window destroy
Signal decorator to define hotkey
You can define global key:
wm.on_key('Alt+Return')(
spawn('xterm'))
Or key binded to specific window:
@wm.on_create(cls='URxvt')
def bind_urxvt_keys():
# Custom key to close only urxvt windows
wm.on_key(wm.event_window, 'Ctrl+d')(
close)
Key defenition is a string in format [mod + ... +]keysym where mod is one of modificators [Alt, Shift, Control(Ctrl), Mod(Win)] and keysym is a key name.
Signal decorator to handle window property change
One can handle any window property change:
@wm.on_property_change('_NET_WM_STATE')
def window_maximized_state_change():
state = wm.get_window_state(wm.event_window)
if state.maximized_vert and state.maximized_horz:
print 'Look, ma! Window is maximized now!'
And specific window:
@wm.on_create
def switch_to_desktop():
if not wm.startup:
if wm.activate_window_desktop(wm.event_window) is None:
# Created window has no any attached desktop so wait for it
@wm.on_property_change(wm.event_window, '_NET_WM_DESKTOP')
def property_was_set():
wm.activate_window_desktop(wm.event_window)
property_was_set.remove()
Float up window in wm stack
Float down window in wm stack
Activate desktop num
Window state
Has following attributes:
alias of State