ReadonlyisWhether this filter is paused
ReadonlyrulesThis filter's rules, as an object hs.windowfilter.create() and setRules() accept, or
null for a filter made from a function
How windows() sorts windows when not told otherwise: "focusedLast" (most recently
focused first, the default), "focused", "createdLast" (newest first) or "created".
Windows that existed before Hammerspoon started watching count as older than any created
since, in order of their IDs, and as focused in their order on screen, front to back.
Allows an application's visible windows. The same as setAppRule(app, true).
The application's name or bundle ID
This filter
A new filter with the same rules, which can then be changed without affecting this one
The new filter
Focuses the nearest window this filter allows that is to the right of a window
Optionaloptions: { frontmost?: boolean; strict?: boolean; window?: HSWindow } | null
How to choose the windows
Optionalfrontmost?: booleantrue to put windows that can be seen before windows hidden behind others
Optionalstrict?: booleantrue to only consider windows within 45° of the direction, rather than anywhere on that side of the window
Optionalwindow?: HSWindowThe window to start from. Defaults to the focused window
true if a window was focused, false if there was none to focus
Focuses the nearest window this filter allows that is above a window
Optionaloptions: { frontmost?: boolean; strict?: boolean; window?: HSWindow } | null
How to choose the windows
Optionalfrontmost?: booleantrue to put windows that can be seen before windows hidden behind others
Optionalstrict?: booleantrue to only consider windows within 45° of the direction, rather than anywhere on that side of the window
Optionalwindow?: HSWindowThe window to start from. Defaults to the focused window
true if a window was focused, false if there was none to focus
Focuses the nearest window this filter allows that is below a window
Optionaloptions: { frontmost?: boolean; strict?: boolean; window?: HSWindow } | null
How to choose the windows
Optionalfrontmost?: booleantrue to put windows that can be seen before windows hidden behind others
Optionalstrict?: booleantrue to only consider windows within 45° of the direction, rather than anywhere on that side of the window
Optionalwindow?: HSWindowThe window to start from. Defaults to the focused window
true if a window was focused, false if there was none to focus
Focuses the nearest window this filter allows that is to the left of a window
Optionaloptions: { frontmost?: boolean; strict?: boolean; window?: HSWindow } | null
How to choose the windows
Optionalfrontmost?: booleantrue to put windows that can be seen before windows hidden behind others
Optionalstrict?: booleantrue to only consider windows within 45° of the direction, rather than anywhere on that side of the window
Optionalwindow?: HSWindowThe window to start from. Defaults to the focused window
true if a window was focused, false if there was none to focus
Whether this filter could allow any of an application's windows: false if the
application is rejected outright
The application's name or bundle ID
false if none of the application's windows can be allowed
Whether this filter allows a window
The window
true if the window is allowed
Removes a listener registered with on() or once()
The event it was registered for
The function originally registered
Registers a listener for an event about this filter's windows. A filter with listeners keeps working after you drop your reference to it, until its listeners are removed or it's paused.
The event to listen for
Called with the window, its application's name, and the event's name. Only windowsChanged passes nulls, when there are no windows left
Registers a listener that's called once, the next time the event happens, then removed
The event to listen for
Called once
Stops calling this filter's listeners, until resume(). Its listeners stay registered.
A paused filter doesn't keep itself alive, so keep a reference to one you mean to resume.
This filter
Rejects all of an application's windows. The same as setAppRule(app, false).
The application's name or bundle ID
This filter
Sets the rule for one application's windows, which replaces the default rule for them
The application's name or bundle ID
true for its visible windows, false for none, an object of conditions (as for the default rule of hs.windowfilter.create()), or null to remove the application's rule so the default applies again
This filter
Sets the override rule's currentSpace condition, leaving its other conditions alone
true to allow only windows in the current Space (along with minimized and hidden windows, which belong to every Space), false to reject them, or null to ignore Spaces
This filter
Sets the rule for applications that have no rule of their own
true for visible windows, false for none, an object of conditions, or null for every window with a standard role
This filter
Sets the rule every window must pass, whatever its application's rule says
true for visible windows only, false for none, an object of conditions, or null for no override rule
This filter
Replaces all of this filter's rules
The rules, as for hs.windowfilter.create()
This filter
The windows this filter allows, sorted
OptionalsortOrder: "focusedLast" | "focused" | "createdLast" | "created"
How to sort them: most or least recently focused first, or newest or oldest first. Defaults to the filter's sortOrder
The windows
The windows this filter allows that are to the right of a window, nearest first. Only windows on
screen count, so combine this with a currentSpace rule (or use
hs.windowfilter.currentSpaceFilter) to ignore windows on other Spaces cheaply.
Optionaloptions: { frontmost?: boolean; strict?: boolean; window?: HSWindow } | null
How to choose the windows
Optionalfrontmost?: booleantrue to put windows that can be seen before windows hidden behind others
Optionalstrict?: booleantrue to only consider windows within 45° of the direction, rather than anywhere on that side of the window
Optionalwindow?: HSWindowThe window to start from. Defaults to the focused window
The windows, nearest first
The windows this filter allows that are above a window, nearest first. Only windows on
screen count, so combine this with a currentSpace rule (or use
hs.windowfilter.currentSpaceFilter) to ignore windows on other Spaces cheaply.
Optionaloptions: { frontmost?: boolean; strict?: boolean; window?: HSWindow } | null
How to choose the windows
Optionalfrontmost?: booleantrue to put windows that can be seen before windows hidden behind others
Optionalstrict?: booleantrue to only consider windows within 45° of the direction, rather than anywhere on that side of the window
Optionalwindow?: HSWindowThe window to start from. Defaults to the focused window
The windows, nearest first
The windows this filter allows that are below a window, nearest first. Only windows on
screen count, so combine this with a currentSpace rule (or use
hs.windowfilter.currentSpaceFilter) to ignore windows on other Spaces cheaply.
Optionaloptions: { frontmost?: boolean; strict?: boolean; window?: HSWindow } | null
How to choose the windows
Optionalfrontmost?: booleantrue to put windows that can be seen before windows hidden behind others
Optionalstrict?: booleantrue to only consider windows within 45° of the direction, rather than anywhere on that side of the window
Optionalwindow?: HSWindowThe window to start from. Defaults to the focused window
The windows, nearest first
The windows this filter allows that are to the left of a window, nearest first. Only windows on
screen count, so combine this with a currentSpace rule (or use
hs.windowfilter.currentSpaceFilter) to ignore windows on other Spaces cheaply.
Optionaloptions: { frontmost?: boolean; strict?: boolean; window?: HSWindow } | null
How to choose the windows
Optionalfrontmost?: booleantrue to put windows that can be seen before windows hidden behind others
Optionalstrict?: booleantrue to only consider windows within 45° of the direction, rather than anywhere on that side of the window
Optionalwindow?: HSWindowThe window to start from. Defaults to the focused window
The windows, nearest first
A window filter: a set of rules choosing some of the windows on the system.
Get the windows it allows with
windows(), or listen for windows being created, moved, focused etc. withon(). Create one withhs.windowfilter.create().Events
Listeners are called with the window, its application's name, and the event's name. They're only told about windows the filter allows, or has just stopped allowing (so they hear why it stopped).
windowCreated,windowDestroyed. A destroyed window has gone, so only itsidcan still be read (and its application's name is passed to the listener).windowMoved: moved or resized, including going fullscreenwindowFullscreened,windowUnfullscreenedwindowMinimized,windowUnminimizedwindowHidden,windowUnhidden: its application was hidden or unhiddenwindowVisible,windowNotVisible: it's visible when it's neither minimized nor hiddenwindowInCurrentSpace,windowNotInCurrentSpace: whether it's on a Space currently shown. Minimized and hidden windows count as being in every Space.windowOnScreen,windowNotOnScreen: whether it's actually on screen: visible, and in a Space currently shownwindowFocused,windowUnfocusedwindowTitleChangedFive more events are about the filter's set of allowed windows:
windowAllowed: a window is now allowed. Emitted before any other event about it, e.g. beforewindowCreatedfor a new window.windowRejected: a window is no longer allowed, or was destroyed. Emitted after the events that caused it.hasWindow: the filter allows a window, having allowed nonehasNoWindows: the filter allows no windows any more. The listener gets the last one.windowsChanged: the set of allowed windows changed. The listener gets one of the allowed windows, ornullif there are none.Moves, resizes and title changes are reported once the window has stopped changing for a moment, so dragging a window emits one
windowMoved, not hundreds.