hammerspoon
hammerspoon copied to clipboard
hs.expose and Emacs
When Emacs GUI App is used with ns-use-native-fullscreen nil
and has the frame in fullscreen mode - somehow hs.expose
doesn't see it. I've tried all sorts of things - overriding hs.window.filter
, changing hs.expose.ui
parameters - nothing helps.
It's not necessarily bug in Hammerspoon, but I would like to find a way to make expose
to "see" Emacs. I don't want to turn ns-use-native-fullscreen t
- it's sucks
Most likely the default windowfilter cannot see it; you should gather the necessary info on the (fullscreened) window (notably its :role()
and :subrole()
) and use a custom windowfilter, or adjust the default windowfilter via hs.window.filter.default:setAppFilter(emacsAppName,{allowRoles=...,...})
(and possibly also :setOverrideFilter()
if the window is non-standard)
@lowne that's the thing, in:
hs.inspect(hs.window.filter.new(true):getWindows())
Emacs appears
@agzam still worth grabbing the :role()
and :subrole()
- Emacs often seems to cause issues with Hammerspoon because they like to declare themselves as a utility panel instead of a window, for some reason.
@cmsj I still feel there's something quite not right with hs.expose
. So this for example should show only windows of iTerm and Chrome, right?: hs.expose.new(hs.window.filter.new{"iTerm2", "Google Chrome"}):show()
, but no, it shows all available windows
yup, it does seem to be that:
-
hs.expose
ignoreshs.window.filter
(no matter what you set it to - it will use all available standard windows - I can' find a way to set nonstandard window with subrole "AXUnknown" to be used in
hs.window.filter
yup, it does seem to be that:
- hs.expose ignores hs.window.filter (no matter what you set it to - it will use all available standard windows
I think I can confirm this. Try one of the examples from expose's documentation in the console:
hs.expose.new{'Safari','Google Chrome'}:show()
All windows are always shown, the filter seems to be ignored. Maybe this bug should be retitled to "hs.expose ignores its window filter"? Or should a new issue be opened for that?
- I can' find a way to set nonstandard window with subrole "AXUnknown" to be used in hs.window.filter
Not sure if this would help but how about allowRoles = '*'
? For example, here's a filter I use with hs.hints
:
some_filter:setAppFilter('Emacs', {allowRoles = '*', allowTitles = 1})
(I'm using the Emacs Mac port and every visible Emacs window seems to have a companion window with no title. It seems OK to ignore this title-less window, hence allowTitles = 1
.)
@dsedivec the last thing you showed worked for Emacs (when it's in fullscreen and when not), but then how do I define a filter that works for all the apps. For example 'iTerm2' in fullscreen has same problem
@dsedivec the last thing you showed worked for Emacs (when it's in fullscreen and when not), but then how do I define a filter that works for all the apps. For example 'iTerm2' in fullscreen has same problem
I have to confess that I stopped using Hammerspoon due to bugs, but IIRC you can just set another allowRoles = '*'
filter for iTerm2, such as:
some_filter:setAppFilter('Emacs', {allowRoles = '*', allowTitles = 1})
some_filter:setAppFilter('iTerm2', {allowRoles = '*'})
You could call both of those on some_filter
, and they are cumulative, so to speak.
To reiterate, though, I'm not using Hammerspoon right now, so I haven't tested this and I'm just going off memory.
@dsedivec right... I have figured it just before you have answered. Thanks a lot! btw. sad that you've stopped using Hammerspoon
@agzam Can you show the final version? I just want a simple, non-filtered expose, but it doesn't show me all my apps. If I switch to an app after opening Hammerspoon, sometimes it gets shown (depends on the app). I also have emacs, but this problem happens with other apps, emacs is not special.
hs.expose.ui.fitWindowsInBackground = false
expose = hs.expose.new(
nil, {
fitWindowsInBackground = hs.expose.ui.fitWindowsInBackground, -- probably @redundant
showThumbnails=true,
onlyActiveApplication=false,
includeOtherSpaces=true,
})
-- then bind to a hotkey
hyper_bind_v2{mods={"ctrl"}, key='[', pressedfn=function()expose:toggleShow()end}