
It's been around a year since I switched from ARC browser to Chromium... (Date is 2025-06-17)
Finally got around to doing this:
Applescript:
tell application "Chromium"
set wList to every window whose visible is true
repeat with app_window in wList
tell app_window
repeat with currentTab in every tab
if (URL of currentTab) contains "meet.google.com" then
set active tab index of app_window to 1
set index of app_window to 1
exit repeat
end if
end repeat
end tell
end repeat
end tell
And in my hammerspoon just running it whenever Chromium is focused and I'm pressing cmd-v (but only for right command
Lua:
function handleLayerEvent(keycode)
if not hasEnteredLayer then
return
end
...
if keycode == 9 and hs.application.frontmostApplication():title() == "Chromium" then
hs.osascript.applescriptFromFile("/Users/s.../scripting/select_google_meet_in_chrome.applescript")
return true
end
...
This script listens only for right cmd, then does some various things when it is pressed down, like launching apps, running scripts, adjusting windows when certain key commands are pressed
Lua:
event = hs.eventtap.new({hs.eventtap.event.types.keyDown,
hs.eventtap.event.types.keyUp,
hs.eventtap.event.types.flagsChanged}, function(e)
keycode = e:getKeyCode()
local type = e:getType()
local rawFlags = e:getRawEventData().CGEventData.flags & 0xdffffeff
if type == hs.eventtap.event.types.keyDown then
if handleLayerEvent(keycode) then
return true, {} -- eat the event
end
if handleRemapEvent(e) then
return true, {} -- eat the event
end
elseif type == hs.eventtap.event.types.keyUp then
elseif type == hs.eventtap.event.types.flagsChanged then
flags = e:getFlags()
-- since we don't actually get keyUp for right command, use absence of other keys to get whether right command keyUp event..
rightCmdKeyUp = not (flags.shift or flags.alt or flags.ctrl or flags.fn or flags.cmd)
if rawFlags == 1048592 and hasEnteredLayer == false then
hasEnteredLayer = true
-- enterSound:play()
elseif rightCmdKeyUp and hasEnteredLayer == true then
-- exitSound:play()
hasEnteredLayer = false
end
end
end):start()