Built-in Hooks

subscribe.focus_change(func)

Called when focus is changed.

subscribe.client_urgent_hint_changed(func)

Called when the client urgent hint changes.

subscribe.current_screen_change(func)

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

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
subscribe.float_change(func)

Called when a change in float state is made

subscribe.client_focus(func)

Called whenver focus changes.

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

Called whenever a group change occurs.

subscribe.selection_notify(func)

Called on selection notify.

subscribe.addgroup(func)

Called when group is added.

subscribe.setgroup(func)

Called when group is changed.

subscribe.client_name_updated(func)

Called when the client name changes.

subscribe.client_mouse_enter(func)

Called when the mouse enters a client.

subscribe.group_window_add(func)

Called when a new window is added to a group.

subscribe.client_killed(func)

Called after a client has been unmanaged.

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

Called on layout change.

subscribe.client_state_changed(func)

Called whenever client state changes.

subscribe.window_name_change(func)

Called whenever a windows name changes.

subscribe.client_type_changed(func)

Called whenever window type changes.

subscribe.net_wm_icon_change(func)

Called on _NET_WM_ICON chance.

subscribe.delgroup(func)

Called when group is deleted.

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)
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()
subscribe.selection_change(func)

Called on selection chance.

subscribe.startup(func)

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

subscribe.startup_once(func)

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