Command Registry and Included Commands (commands.py
)¶
Available window-management commands
-
class
CommandRegistry
[source]¶ Lookup and dispatch boilerplate for window management commands.
-
add
(name, *p_args, **p_kwargs)[source]¶ Decorator to wrap a function in boilerplate and add it to the command registry under the given name.
- Note
The
windowless
parameter allows a command to be registered as not requiring an active window.- Parameters
name (
str
) – The name to register the command for lookup by.p_args (
Any
) – Positional arguments to prepend to all calls made vianame
.p_kwargs (
Any
) – Keyword arguments to prepend to all calls made vianame
.windowless (bool) – Allow the command to be invoked when no relevant active window can be retrieved.
- Raises
AssertionError – Raised if the wrapped function has no docstring.
-
add_many
(command_map)[source]¶ Convenience decorator to call
add()
repeatedly to assing multiple command names to the same function which differ only in their arguments.
-
call
(command, winman, *args, **kwargs)[source]¶ Look up a registered command by name and execute it.
- Parameters
- Parameters
winman (
WindowManager
) –- Return type
-
extra_state
: Dict[str, Any] = {}¶ Fields to be added to the
state
argument when calling commands
-
static
get_window_meta
(window, state, winman)[source]¶ Gather information about
window
to pass to the command- Parameters
window (
Wnck.Window
) – The window to inspect.state (
Dict
[str
,Any
]) – The metadata dict todict.update()
with gathered values.
- Return type
- Returns
A boolean indicating success or failure.
- Parameters
winman (
WindowManager
) –
-
-
commands
= <quicktile.commands.CommandRegistry object>¶ The instance of
CommandRegistry
to be used in 99.9% of use cases.
-
cycle_dimensions
(winman, win, state, *dimensions)[source]¶ Cycle the active window through a list of positions and shapes.
Takes one step each time this function is called.
Keeps track of its position by storing the index in an X11 property on
win
named_QUICKTILE_CYCLE_POS
.- Parameters
- Return type
- Returns
The new window dimensions.
- Parameters
winman (
WindowManager
) –
-
cycle_monitors
(winman, win, state, step=1, force_wrap=False, n_monitors=None)[source]¶ Cycle the active window between monitors.
Attempts to preserve each window’s position but will ensure that it doesn’t get placed outside the available space on the target monitor.
- Parameters
win (
Wnck.Window
) – The window to operate on.step (
int
) – How many monitors to step forward or backward.force_wrap (
bool
) – If :any`True`, this will override setting MovementsWrap toFalse
.winman (
WindowManager
) –
- Return type
None
-
cycle_monitors_all
(winman, win, state, step=1, force_wrap=False)[source]¶ Cycle all windows between monitors.
(Apply
cycle_monitors()
to all windows.)Attempts to preserve each window’s position but will ensure that it doesn’t get placed outside the available space on the target monitor.
- Parameters
win (
Wnck.Window
) – The window to operate on.step (
int
) – Passed tocycle_monitors()
force_wrap (
bool
) – Passed tocycle_monitors()
winman (
WindowManager
) –
- Return type
None
-
move_to_position
(winman, win, state, gravity)[source]¶ Move the active window to a position on the screen, preserving its dimensions.
- Parameters
win (
Wnck.Window
) – The window to operate on.gravity (
Gravity
) –winman (
WindowManager
) –
- Return type
None
-
toggle_decorated
(winman, win, state)[source]¶ Toggle window decoration state on the active window.
- Parameters
win (
Wnck.Window
) – The window to operate on.winman (
WindowManager
) –
- Return type
None
-
toggle_desktop
(winman, win, state)[source]¶ Toggle “all windows minimized” to view the desktop.
- Parameters
win (
Wnck.Window
) – Unusedwinman (
WindowManager
) –
- Return type
None
-
toggle_state
(winman, win, state, command, check, takes_bool=False)[source]¶ Toggle window state on the active window.
This is an abstraction to unify a bunch of different
Wnck.Window
methods behind a common wrapper.- Parameters
winman (
WindowManager
) – Unusedwin (
Wnck.Window
) – The window to operate on.command (
str
) – The method name to be conditionally prefixed withun
, resolved fromwin
, and called.check (
str
) – The method name to be called onwin
to check whethercommand
should be prefixed withun
.takes_bool (
bool
) – IfTrue
, passTrue
orFalse
tocheck
rather thank conditionally prefixing it withun
before resolving.
- Return type
None
-
trigger_keyboard_action
(winman, win, state, command)[source]¶ Ask the Window Manager to begin a keyboard-driven operation.
- Parameters
winman (
WindowManager
) – Unusedwin (
Wnck.Window
) – The window to operate on.command (
str
) – The string to be appended tokeyboard_
and used as a method name to look up onwin
.
- Return type
None
-
workspace_go
(winman, win, state, motion)[source]¶ Switch the active workspace.
(Integer values for
motion
may cause wrap-around behaviour depending on the value of MovementsWrap.)- Parameters
state (
Dict
[str
,Any
]) – Used to access the MovementsWrap configuration key.motion (
Wnck.MotionDirection
) – The direction to move the window on the workspace grid or the distance to move it by numerical ordering. AcceptsWnck.MotionDirection
orint
.win (
Optional
[Wnck.Window
]) – Unused but required by the command API.winman (
WindowManager
) –
- Return type
None
-
workspace_send_window
(winman, win, state, motion)[source]¶ Move the active window to another workspace.
(Integer values for
motion
may cause wrap-around behaviour depending on the value of MovementsWrap.)- Parameters
state (
Dict
[str
,Any
]) – Used to access the MovementsWrap configuration key.motion (
int
) – The direction to move the window on the workspace grid or the distance to move it by numerical ordering. AcceptsWnck.MotionDirection
orint
.win (
Wnck.Window
) – The window to operate on.winman (
WindowManager
) –
- Return type
None