-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzoom_detect.lua
More file actions
executable file
·51 lines (47 loc) · 1.56 KB
/
Copy pathzoom_detect.lua
File metadata and controls
executable file
·51 lines (47 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
-- Hammerspoon script to automatically update your slack status when in zoom
--
-- To use:
--
-- * Install and set up the slack_status.sh script (make sure it's in your
-- path)
-- * Ensure there is a 'zoom' preset (one is created by default during setup)
-- * Install hammerspoon (brew install hammerspoon) if you don't have it
-- already.
-- * Copy this file to ~/.hammerspoon
-- * Add the following line to ~/.hammerspoon/init.lua
-- local zoom_detect = require("zoom_detect")
-- * If it's a fresh `brew install` of Hammerspoon, start it and make sure
-- accessibility is enabled
-- Configuration
check_interval=20 -- How often to check if you're in zoom, in seconds
function update_status(status)
task = hs.execute("slack_status.sh " .. status, true)
end
function in_zoom_meeting()
local a = hs.application.find("zoom.us")
if a ~= nil then
m = a:findMenuItem("Join Meeting...")
-- Start meeting menu item exists and is disabled
return m ~= nil and not m["enabled"]
else
-- Zoom isn't running
return false
end
end
inzoom = false
zoomTimer = hs.timer.doEvery(check_interval, function()
if in_zoom_meeting() then
if inzoom == false then
inzoom = true
hs.notify.show("Started zoom meeting", "Updating slack status", "")
update_status("zoom")
end
else
if inzoom == true then
inzoom = false
hs.notify.show("Left zoom meeting", "Updating slack status", "")
update_status("none")
end
end
end)
zoomTimer:start()