-
Notifications
You must be signed in to change notification settings - Fork 595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hs.alert.show: how to place this alert on different place on screen (center?) #3541
Comments
There's no way to change position (aside from choosing a screen) currently in the extension, but the extension is all Lua, so you could copy and modify as needed: hammerspoon/extensions/alert/alert.lua Line 78 in 0ccc9d0
|
thanks for the hint. i tried to fake an screen object from a window object to get it to the alert as "Screenobject" - the only thing missing was the hammerspoon/extensions/alert/alert.lua Line 103 in 0ccc9d0
but this patch from chat gpt not working :( local win = hs.window.focusedWindow()
local extendedWindowMetatable = {
__index = {
fullFrame = function(self)
return self:frame()
end
}
}
setmetatable(win, extendedWindowMetatable)
hs.alert.show("Hello World!", win) i have done it with this patch in - local screenFrame = screenObj:fullFrame()
+ local screenFrame = screenObj.frame and screenObj:frame() or screenObj:fullFrame() muescha/dot_hammerspoon@7a95c28 now i can call it with hs.alert.show("Hello World!", win) |
one idea was to allow a |
a little bug: - local screenFrame = screenObj.frame and screenObj:frame() or screenObj:fullFrame()
+ local screenFrame = screenObj.fullFrame and screenObj:fullFrame() or screenObj:frame() |
opened:
|
PR is merged, so I'm going to close this. |
For what it's worth: local geometryMT = getmetatable(hs.geometry '0x0')
if getmetatable(frame) == geometryMT then
-- …
end |
FWIW, lua only code can add its metatable to the registry so debug.getregistry()[userdata_tag] = metatable Then, |
How can I position the 'hs.alert.show' alert at a different location on the screen?
I'd prefer to have it centered within a child window of an app that's not in full-screen mode.
The text was updated successfully, but these errors were encountered: