Skip to content

Commit 00aace7

Browse files
authored
Update alert.lua: allow window object as parameter (#3542)
allow also a `hs.window` object as an parameter
1 parent 11265bd commit 00aace7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

extensions/alert/alert.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ local showAlert = function(message, image, style, screenObj, duration)
100100
-- print(finspect(message:asTable()))
101101
end
102102

103-
local screenFrame = screenObj:fullFrame()
103+
local screenFrame = screenObj.fullFrame and screenObj:fullFrame() or screenObj:frame()
104104

105105
local absoluteTop = screenFrame.y + (screenFrame.h * (1 - 1 / 1.55) + 55) -- mimic module behavior for inverted rect
106106
if thisAlertStyle.atScreenEdge > 0 then
@@ -225,7 +225,7 @@ end
225225
--- * str - The string or `hs.styledtext` object to display in the alert
226226
--- * image - The image to display in the alert
227227
--- * style - an optional table containing one or more of the keys specified in [hs.alert.defaultStyle](#defaultStyle). If `str` is already an `hs.styledtext` object, this argument is ignored.
228-
--- * screen - an optional `hs.screen` userdata object specifying the screen (monitor) to display the alert on. Defaults to `hs.screen.mainScreen()` which corresponds to the screen with the currently focused window.
228+
--- * screen - an optional `hs.screen` or `hs.window` userdata object specifying the screen (monitor) or window to display the alert on. Defaults to `hs.screen.mainScreen()` which corresponds to the screen with the currently focused window.
229229
--- * seconds - The number of seconds to display the alert. Defaults to 2. If seconds is specified and is not a number, displays the alert indefinitely.
230230
---
231231
--- Returns:

0 commit comments

Comments
 (0)