Command Registry and Included Commands (commands.py)

Available window-management commands

class CommandRegistry[source]

Lookup and dispatch boilerplate for window management commands.

__str__()[source]

Pretty-print a table of registered commands

Return type

str

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 via name.

  • p_kwargs (Any) – Keyword arguments to prepend to all calls made via name.

  • 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.

Return type

Callable[[Callable[…, Any]], Callable[…, Any]]

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.

Parameters

command_map (Dict[str, List[Any]]) – A dict mapping command names to lists of arguments.

Return type

Callable[[Callable[…, Any]], Callable[…, Any]]

call(command, winman, *args, **kwargs)[source]

Look up a registered command by name and execute it.

Parameters
  • command (str) – The name of the command to execute.

  • args (Any) – Positional arguments to pass to the command.

  • kwargs (Any) – Keyword arguments to pass to the command.

Parameters

winman (WindowManager) –

Return type

bool

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
Return type

bool

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

Optional[Rectangle]

Returns

The new window dimensions.

Parameters
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
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
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
Return type

None

toggle_decorated(winman, win, state)[source]

Toggle window decoration state on the active window.

Parameters
Return type

None

toggle_desktop(winman, win, state)[source]

Toggle “all windows minimized” to view the desktop.

Parameters
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) – Unused

  • win (Wnck.Window) – The window to operate on.

  • state (Dict[str, Any]) – Unused

  • command (str) – The method name to be conditionally prefixed with un, resolved from win, and called.

  • check (str) – The method name to be called on win to check whether command should be prefixed with un.

  • takes_bool (bool) – If True, pass True or False to check rather thank conditionally prefixing it with un 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) – Unused

  • win (Wnck.Window) – The window to operate on.

  • state (Dict[str, Any]) – Unused

  • command (str) – The string to be appended to keyboard_ and used as a method name to look up on win.

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
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
Return type

None