Pointer
When the pointer follows focus, and when focus follows the pointer
sweets.pointer decides when the cursor follows keyboard-driven focus and
workspace changes, and whether moving the cursor into a window focuses it.
sweets.pointer({
focus_follows_mouse = true,
focus_follows_mouse_threshold = 8,
follow_focus = true,
follow_focus_restore = true,
follow_workspace = true,
follow_new_window = true,
follow_new_window_dialogs = false,
hide_when_following = false,
})| Field | Type | Default | Description |
|---|---|---|---|
focus_follows_mouse | boolean | true | Focus a window when the pointer moves into it |
focus_follows_mouse_threshold | integer, 0–100 | 0 | Movement in logical pixels required inside a newly entered window before it receives keyboard focus |
follow_focus | boolean | true | Move the pointer onto a window when keyboard focus moves to it |
follow_focus_restore | boolean | true | Return to the last position on that window; false always centers |
follow_workspace | boolean | true | Move the pointer after a workspace switch |
follow_new_window | boolean | true | Move the pointer to a newly opened window |
follow_new_window_dialogs | boolean | false | Include dialogs and transient windows in the above |
hide_when_following | boolean | false | Hide the cursor after an automatic move until you use it |
focus_follows_mouse
Set it to false for click-to-focus:
sweets.pointer({
focus_follows_mouse = false,
})Pointer entry then changes nothing and a click focuses the window. This helps with a trackball or tablet parked over the wrong window, and with applications whose hover menus reach past their own edge.
Set focus_follows_mouse_threshold = 8 to ignore a small movement across a
window edge. Pointer events still reach the window immediately. Moving another
8 logical pixels from the entry point gives it keyboard focus. A click focuses
it immediately. Set the threshold to 0 for immediate entry focus.
Moving onto another monitor still selects that monitor either way, so an empty monitor stays reachable without a click. Selecting a monitor does not change keyboard focus.
focus_follows_mouse and follow_focus are opposites. This one lets the
pointer choose the focused window; follow_focus moves the pointer after a
focus action.
follow_focus
With follow_focus_restore on, each window remembers where the pointer sat
when focus last left it and the cursor returns there. A window with nothing
remembered, or one that resized while unfocused, is centered instead.
Closing the focused window moves focus and the pointer to the next window immediately, without waiting for the close animation.
follow_workspace
Sweets restores the pointer to the window you were using on that workspace. If nothing is remembered it centers on the focused window, or on the monitor for an empty workspace.
Turning this off stops the warp only. A workspace switch still makes that monitor active, so new windows open there even with the cursor elsewhere. Moving the mouse makes the monitor under it active again.
Switching to a workspace focuses the window you last used there, not the master. The pointer follows that window.
follow_new_window
The pointer stays put for the first window on an empty workspace. It still follows windows that open alongside existing ones.
hide_when_following
Hides the cursor after an automatic move only. Moving the mouse, clicking, or scrolling brings it back.
Client pointer warp
Apps using wp_pointer_warp_v1 can move the cursor within their focused
surface. Sweets accepts a valid pointer-enter serial and keeps the cursor
within the surface and active monitor. A session lock, compositor drag, pointer
lock, or confinement region can block the request. No setting is required.
Hot corners
Use sweets.hot_corner to run a binding action when a physical pointer enters
an output corner:
sweets.hot_corner("top-left", "special_toggle", "notes")
sweets.hot_corner("bottom-right", "spawn", { "fuzzel" }, { size = 4 })
sweets.hot_corner("top-right", { { "toggle_floating" }, { "center_window" } }, { size = 12 })A corner also accepts the bounded action list used by key bindings. Its
options table follows the list directly, without a nil placeholder.
The corners are top-left, top-right, bottom-right, and bottom-left.
size defaults to 8 logical pixels and accepts 1 through 256. The optional
monitor selects a connector name or a { make, model, serial } identity,
using the same syntax as monitor rules. Without
it, the corner applies to every enabled, powered output. Set fullscreen = true
to allow the action while that output shows a real fullscreen window; the
default is false. For an action without an argument, pass nil before options:
sweets.hot_corner("top-right", "workspace_relative_next", nil, {
monitor = "DP-1",
fullscreen = true,
})A corner runs once on entry. Move out and back in to run it again. Pointer
motion while locked, paused, dragging, or grabbed does not run it. Virtual
pointer motion and automatic cursor movement do not run it either. A reload
while the pointer is already in a corner waits for an exit and re-entry.
Declarations append across configuration layers, up to 64 total; no corner is
configured by default. Use any binding action except move_window and
resize_window, which need a held pointer-button grab.