meain/blog

Jul 31, 2021 . 2 min

Zooming into Zoom meetings

Well, I have been attending a lot of meetings lately. More than I would like to admit. The number of meetings have gone down compared to the start of the pandemic, but it is still a lot. To be frank, sometimes really you have to talk things through instead of just texting people.

OK, with all that aside, let me get to the actual content. I just wanted to show you a quick simple hack that I use to start a meeting and send the link in the current chat that I am on. I am on macOS and use a tool called hammerspoon to help me with this. But to be frank, it is pretty much the idea that I wanted to put out there than the actual implementation.

Clipboard is a universal data transfter medium that almost everything supports

So, here is what I am doing.

First thing to do is to enable a setting in zoom which copies the meeting url when you start a new meeting. In the general tab, make sure "Copy invite link when I starting a meeting" is checked. Now with that out of the way, let us write the hammerspoon part of the code.

Zoom setting image

OK, what the code has to do is:

These steps can be literally converted to code:

-- Save current window
local currentApp = hs.window.focusedWindow()
-- Open/Focus zoom
hs.application.launchOrFocus("zoom.us")
-- Start meeting
hs.eventtap.keyStroke({"cmd", "ctrl"}, "v") -- shortcut to start meeting
-- Wait for meeting to start (wait for clipboard to have meeting link)
local clipChanged = waitTillClipChanges(7) -- util func code below
-- Focus original window
currentApp:focus()
-- Paste the link
hs.eventtap.keyStroke({"cmd"}, "v")

And there you go, that is all that you have to do. Just another crude hack that makes my life easier. You can find the full code below or in my dotfiles repo.

function waitTillClipChanges(maxTime)
local initialClip = pasteboard.getContents()
local i = maxTime
while (i > 0) do
os.execute("sleep " .. tonumber(1))
if (pasteboard.getContents() ~= initialClip) then
return true
end
i = i - 1
end
return false
end

hs.hotkey.bind(
{"ctrl", "alt", "shift"},
"z",
function()
local currentApp = hs.window.focusedWindow()
hs.application.launchOrFocus("zoom.us")
hs.eventtap.keyStroke({"cmd", "ctrl"}, "v")
local clipChanged = waitTillClipChanges(7)
if not clipChanged then
-- in case zoom was not open, redo the thing
hs.application.launchOrFocus("zoom.us")
hs.eventtap.keyStroke({"cmd", "ctrl"}, "v")
waitTillClipChanges(7)
end
currentApp:focus()
hs.eventtap.keyStroke({"cmd"}, "v")
end
)

K. THX. BYE

← Home