Built-in Hooks

subscribe.window_name_change(func)

Called whenever a windows name changes.

subscribe.client_urgent_hint_changed(func)

Called when the client urgent hint changes.

subscribe.client_name_updated(func)

Called when the client name changes.

subscribe.selection_notify(func)

Called on selection notify.

subscribe.delgroup(func)

Called when group is deleted.

subscribe.group_window_add(func)

Called when a new window is added to a group.

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

Called when group is added.

subscribe.startup(func)

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

subscribe.selection_change(func)

Called on selection chance.

subscribe.client_focus(func)

Called whenver focus changes.

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

Called when a change in float state is made

subscribe.client_state_changed(func)

Called whenever client state changes.

subscribe.net_wm_icon_change(func)

Called on _NET_WM_ICON chance.

subscribe.client_mouse_enter(func)

Called when the mouse enters a client.

subscribe.client_type_changed(func)

Called whenever window type changes.

subscribe.focus_change(func)

Called when focus is changed.

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

Called whenever a group change occurs.

subscribe.layout_change(func)

Called on layout change.

subscribe.client_killed(func)

Called after a client has been unmanaged.

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

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

subscribe.setgroup(func)

Called when group is changed.

subscribe.startup_once(func)

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

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)