Skip to content

Bar objects

The bar is primarily used to display widgets on the screen. As a result, the bar does not need many of its own commands.

To select a bar on the command graph, you must use a selector (as there is no default bar). The selector is the position of the bar on the screen i.e. "top", "bottom", "left" or "right".

The bar can access the screen it's on and the widgets it contains via the command graph.

.. qtile_graph:: :root: bar

bar

Classes:

  • Bar

    A bar, which can contain widgets.

  • Gap

    A gap placed along one of the edges of the screen.

Bar

Bar(widgets: list[_Widget], size: int, **config: Any)

Bases: Gap, Configurable, CommandObject

A bar, which can contain widgets.

Parameters:

  • widgets (list[_Widget]) –

    A list of widget objects.

  • size (int) –

    The "thickness" of the bar, i.e. the height of a horizontal bar, or the width of a vertical bar.

Methods:

  • add_defaults

    Add defaults to this object, overwriting any which already exist.

  • command

    Return the command with the given name.

  • commands

    Returns a list of possible commands for this object.

  • doc

    Returns the documentation for a specified command name.

  • eval

    Evaluates code in the same context as this function.

  • fake_button_press

    Fake a mouse-button-press on the bar.

  • function

    Call a function with current object as argument.

  • info

    Info for this object.

  • items

    Build a list of contained items for the given item class.

  • kill_window

    Kill the window when the bar's screen is no longer being used.

  • select

    Return a selected object.

  • widget_grab_keyboard

    A widget can call this method to grab the keyboard focus and receive keyboard messages.

  • widget_ungrab_keyboard

    Removes keyboard focus from the widget.

add_defaults

add_defaults(defaults)

Add defaults to this object, overwriting any which already exist.

command

command(name: str) -> Callable | None

Return the command with the given name.

Parameters:

  • name (str) –

    The name of the command to fetch.

commands

commands() -> list[str]

Returns a list of possible commands for this object.

Used by qsh for command completion and online help

doc

doc(name) -> str

Returns the documentation for a specified command name.

Used by qsh to provide online help.

eval

eval(code: str) -> tuple[bool, str | None]

Evaluates code in the same context as this function.

Return value is tuple (success, result), success being a boolean and result being a string representing the return value of eval, or None if exec was used instead.

fake_button_press

fake_button_press(
    screen: int,
    position: str,
    x: int,
    y: int,
    button: int = 1,
) -> None

Fake a mouse-button-press on the bar.

Coordinates are relative to the top-left corner of the bar.

function

function(function, *args, **kwargs) -> None

Call a function with current object as argument.

info

info() -> dict[str, Any]

Info for this object.

items

items(name: str) -> tuple[bool, list[str | int] | None]

Build a list of contained items for the given item class.

Exposing this allows qsh to navigate the command graph.

Returns a tuple (root, items) for the specified item class, where:

root: True if this class accepts a "naked" specification without an
item seletion (e.g. "layout" defaults to current layout), and False
if it does not (e.g. no default "widget").

items: a list of contained items

kill_window

kill_window() -> None

Kill the window when the bar's screen is no longer being used.

select

select(selectors: list[SelectorType]) -> CommandObject

Return a selected object.

Recursively finds an object specified by a list of (name, selector) items.

Raises SelectError if the object does not exist.

widget_grab_keyboard

widget_grab_keyboard(widget: _Widget) -> None

A widget can call this method to grab the keyboard focus and receive keyboard messages.

When done, widget_ungrab_keyboard() must be called.

widget_ungrab_keyboard

widget_ungrab_keyboard() -> None

Removes keyboard focus from the widget.

Gap

Gap(size: int)

A gap placed along one of the edges of the screen.

Qtile will avoid covering gaps with windows.

Parameters:

  • size (int) –

    The "thickness" of the gap, i.e. the height of a horizontal gap, or the width of a vertical gap.

Methods:

  • info

    Info for this object.

info

info() -> dict[str, Any]

Info for this object.