:setAppFilter()
, :setDefaultFilter()
, :setOverrideFilter()
) and they can allow or reject windows based on::getWindows()
):subscribe()
and the module constants with all the events)hs.window.filter.new()
(with no arguments) returns a copy of the default windowfilter that you can further tailor to your needs - see hs.window.filter.default
and hs.window.filter.new()
for more information.hs.window.filter.default
mywf=hs.window.filter.new()
; the default windowfilter can potentially be used in several Hammerspoon modules and changing it might have unintended consequences. Common customizations:nofs_wf=hs.window.filter.new():setOverrideFilter{fullscreen=false}
inv_wf=windowfilter.new():setDefaultFilter{}
init.lua
, or at any rate before instantiating any other windowfilter; this way copies created via hs.window.filter.new(nil,...)
will inherit your modificationshs.inspect(hs.window.filter.default:getFilters())
from the consolehs.window.filter.default:rejectApp'Cool New Launcher'
hs.window.filter.default:setAppFilter('My IDE',1)
; ignore tooltips/code completion (empty title) in My IDEhs.window.filter.default:allowApp'Spotlight'
; for specialized uses you can make a specific windowfilter with myfilter=hs.window.filter.new'Spotlight'
hs.window.filter.defaultCurrentSpace
hs.window.filter.default
) that only allows windows in the currenths.window.filter.hasNoWindows
hs.window.filter:subscribe()
: the windowfilter now rejects all windowswindowDestroyed
) that caused the window to be rejectedhs.window.filter.hasWindow
hs.window.filter:subscribe()
: the windowfilter now allows one windowwindowCreated
) that caused a window to be allowedhs.window.filter.sortByCreated
hs.window.filter:getWindows()
: windows are sorted in order of creation, oldest first (see also hs.window.filter:setSortOrder()
)hs.window.filter.sortByCreatedLast
hs.window.filter:getWindows()
: windows are sorted in order of creation, newest first (see also hs.window.filter:setSortOrder()
)hs.window.filter.sortByFocused
hs.window.filter:getWindows()
: windows are sorted in order of focus received, least recently first (see also hs.window.filter:setSortOrder()
)hs.window.filter.sortByFocusedLast
hs.window.filter:getWindows()
: windows are sorted in order of focus received, most recently first (see also hs.window.filter:setSortOrder()
)hs.window.filter.windowAllowed
hs.window.filter:subscribe()
: a previously rejected window (or a newly created one) is now allowedwindowCreated
) that caused the window to be allowedhs.window.filter.windowCreated
hs.window.filter:subscribe()
: a new window was createdhs.window.filter.windowDestroyed
hs.window.filter:subscribe()
: a window was destroyedhs.window.filter.windowFocused
hs.window.filter:subscribe()
: a window received focushs.window.filter.windowFullscreened
hs.window.filter:subscribe()
: a window was expanded to fullscreenhs.window.filter.windowHidden
hs.window.filter:subscribe()
: a window was hidden (its app was hidden, e.g. via cmd-h
)hs.window.filter.windowInCurrentSpace
hs.window.filter:subscribe()
: a window is now in the current Mission Control Space, due tohs.window.filter.windowMinimized
hs.window.filter:subscribe()
: a window was minimizedhs.window.filter.windowMoved
hs.window.filter:subscribe()
: a window was moved or resized, including toggling fullscreen/maximizehs.window.filter.windowNotInCurrentSpace
hs.window.filter:subscribe()
: a window that used to be in the current Mission Control Space isn't anymore,hs.window.filter.windowNotOnScreen
hs.window.filter:subscribe()
: a window is no longer actually visible on any screen because it was minimized, closed,hs.window.filter.windowNotVisible
hs.window.filter:subscribe()
: a window is no longer "visible" (in any Mission Control Space, as per hs.window:isVisible()
)hs.window.filter.windowOnScreen
hs.window.filter:subscribe()
: a window became actually visible on screen (i.e. it's "visible" as per hs.window:isVisible()
hs.window.filter.windowRejected
hs.window.filter:subscribe()
: a previously allowed window (or a window that's been destroyed) is now rejectedwindowDestroyed
) that caused the window to be rejectedhs.window.filter.windowsChanged
hs.window.filter:subscribe()
: the list of allowed windows (as per windowfilter:getWindows()
) has changedhs.window.filter.windowTitleChanged
hs.window.filter:subscribe()
: a window's title changedhs.window.filter.windowUnfocused
hs.window.filter:subscribe()
: a window lost focushs.window.filter.windowUnfullscreened
hs.window.filter:subscribe()
: a window was reverted back from fullscreenhs.window.filter.windowUnhidden
hs.window.filter:subscribe()
: a window was unhidden (its app was unhidden, e.g. via cmd-h
)hs.window.filter.windowUnminimized
hs.window.filter:subscribe()
: a window was unminimizedhs.window.filter.windowVisible
hs.window.filter:subscribe()
: a window became "visible" (in any Mission Control Space, as per hs.window:isVisible()
)hs.window.filter.allowedWindowRoles
hs.window:subrole()
) that are allowed by default.setAppFilter
, setDefaultFilter
, setOverrideFilter
methods.hs.window.filter.forceRefreshOnSpaceChange
currentSpace
field of a filter is present), windows need refreshing at every space change anyway, so this variable is ignoredhs.window.filter.ignoreAlways
hs.application:name()
) that are always ignored by this module.hs.window.filter.focusEast()
hs.window.filter.defaultCurrentSpace:focusWindowEast(nil,nil,true)
hs.window.filter.focusNorth()
hs.window.filter.defaultCurrentSpace:focusWindowNorth(nil,nil,true)
hs.window.filter.focusSouth()
hs.window.filter.defaultCurrentSpace:focusWindowSouth(nil,nil,true)
hs.window.filter.focusWest()
hs.window.filter.defaultCurrentSpace:focusWindowWest(nil,nil,true)
hs.window.filter.isGuiApp(appname) -> boolean
hs.window.filter.ignoreAlways
hs.application:name()
false
if the app is a known non-GUI (or not accessible) app; true
otherwisehs.window.filter.switchedToSpace(space)
hs.window.filter.forceRefreshOnSpaceChange
to false
currentSpace
field of a filter is present), windows need refreshing at every space change anyway, so using this callback will not result in improved performancehs.window.filter.copy(windowfilter[,logname[,loglevel]]) -> hs.window.filter object
hs.window.filter
object to copyhs.logger
instance for the new windowfilter; if omitted, the class logger will be usedhs.logger
instance for the new windowfilterhs.window.filter.new(fn[,logname[,loglevel]]) -> hs.window.filter object
nil
, returns a copy of the default windowfilter, including any customizations you might have applied to it so far; you can then further restrict or expand ittrue
, returns an empty windowfilter that allows every windowfalse
, returns a windowfilter with a default rule to reject every windowhs.application:name()
hs.window.filter:setFilters()
; if not specified in the table, the default filter in the new windowfilter will reject all windowshs.window
object and returns true
if the window is allowed or false
otherwise; this way you can define a fully custom windowfilterhs.logger
instance for the new windowfilter; if omitted, the class logger will be usedhs.logger
instance for the new windowfilterhs.window.filter:allowApp(appname) -> hs.window.filter object
hs.application:name()
hs.window.filter
object for method chainingwindowfilter:setAppFilter(appname,{visible=true})
hs.window.filter:focusWindowEast(window, frontmost, strict)
hs.window
object; if nil, hs.window.frontmostWindow()
will be usedhs.window.focusWindowEast(window,self:getWindows(),...)
:setCurrentSpace(true)
to the windowfilter used for this method callhs.window.filter:focusWindowNorth(window, frontmost, strict)
hs.window
object; if nil, hs.window.frontmostWindow()
will be usedhs.window.focusWindowNorth(window,self:getWindows(),...)
:setCurrentSpace(true)
to the windowfilter used for this method callhs.window.filter:focusWindowSouth(window, frontmost, strict)
hs.window
object; if nil, hs.window.frontmostWindow()
will be usedhs.window.focusWindowSouth(window,self:getWindows(),...)
:setCurrentSpace(true)
to the windowfilter used for this method callhs.window.filter:focusWindowWest(window, frontmost, strict)
hs.window
object; if nil, hs.window.frontmostWindow()
will be usedhs.window.focusWindowWest(window,self:getWindows(),...)
:setCurrentSpace(true)
to the windowfilter used for this method callhs.window.filter:getFilters() -> table
hs.window.filter:setFilters()
and hs.window.filter.new()
hs.window.filter:getWindows([sortOrder]) -> list of hs.window objects
hs.window.filter.sortBy...
constants to determine the sort order of the returned list; if omitted, uses the windowfilter's sort order as per hs.window.filter:setSortOrder()
(defaults to sortByFocusedLast
)hs.window
objects