Built-in Hooks

classmethod subscribe.group_window_add(func)

Called when a new window is added to a group.

classmethod subscribe.selection_change(func)

Called on selection chance.

classmethod subscribe.client_killed(func)

Called after a client has been unmanaged.

  • arguments: window.Window object of the killed window.
classmethod subscribe.startup_once(func)

Called when Qtile has initialized, exactly once (i.e. not on each lazy.restart()).

classmethod subscribe.setgroup(func)

Called when group is changed.

classmethod subscribe.selection_notify(func)

Called on selection notify.

classmethod subscribe.changegroup(func)

Called whenever a group change occurs.

classmethod subscribe.window_name_change(func)

Called whenever a windows name changes.

classmethod subscribe.delgroup(func)

Called when group is deleted.

classmethod subscribe.client_focus(func)

Called whenver focus changes.

  • arguments: window.Window object of the new focus.
classmethod subscribe.screen_change(func)

Called when a screen is added or screen configuration is changed (via xrandr). The hook should take two arguments: the root qtile object and the xproto.randr.ScreenChangeNotify event. Common usage is simply to call qtile.cmd_restart() on each event (to restart qtile when there is a new monitor):

Example:

def restart_on_randr(qtile, ev):
    qtile.cmd_restart()
classmethod subscribe.startup(func)

Called each time qtile is started (including the first time qtile starts)

classmethod subscribe.client_managed(func)

Called after Qtile starts managing a new client. That is, after a window is assigned to a group, or when a window is made static. This hook is not called for internal windows.

  • arguments: window.Window object
classmethod subscribe.net_wm_icon_change(func)

Called on _NET_WM_ICON chance.

classmethod subscribe.client_urgent_hint_changed(func)

Called when the client urgent hint changes.

classmethod subscribe.layout_change(func)

Called on layout change.

classmethod subscribe.client_state_changed(func)

Called whenever client state changes.

classmethod subscribe.client_name_updated(func)

Called when the client name changes.

classmethod subscribe.client_new(func)

Called before Qtile starts managing a new client. Use this hook to declare windows static, or add them to a group on startup. This hook is not called for internal windows.

  • arguments: window.Window object

Example:

def func(c):
    if c.name == "xterm":
        c.togroup("a")
    elif c.name == "dzen":
        c.static(0)

libqtile.hook.subscribe.client_new(func)
classmethod subscribe.focus_change(func)

Called when focus is changed.

classmethod subscribe.current_screen_change(func)

Called when the current screen (i.e. the screen with focus) changes; no arguments.

classmethod subscribe.float_change(func)

Called when a change in float state is made

classmethod subscribe.addgroup(func)

Called when group is added.

classmethod subscribe.client_type_changed(func)

Called whenever window type changes.

classmethod subscribe.client_mouse_enter(func)

Called when the mouse enters a client.