Skip to content

Instantly share code, notes, and snippets.

@ciriousjoker
Last active July 13, 2025 23:45
Show Gist options
  • Save ciriousjoker/9b2f4647d378740eb6824ed633341a5f to your computer and use it in GitHub Desktop.
Save ciriousjoker/9b2f4647d378740eb6824ed633341a5f to your computer and use it in GitHub Desktop.
READ COMMENT -- Mac OS: Custom Google Chat PWA that opens with the correct user every time
-- Save this as "Google Chat.app"
-- Check "Stay open after run handler" during save dialog
-- Locate "Google Chat.app" and fix the icon yourself (see comment)
on run
-- This runs once on launch and sets the timer.
do shell script "\"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome\" --app=\"https://mail.google.com/chat/u/1/\" &> /dev/null &"
end run
on idle
-- This delay must be at the start, otherwise the script would immediately close
-- because Google Chat isn't open yet.
delay 3
-- Check if the "Chat" window is still open.
tell application "Google Chrome"
try
if not (exists (first window whose title contains "Chat")) then
-- If the window is gone, quit this app.
quit me
end if
on error
-- If Chrome itself was quit, also quit this app.
quit me
end try
end tell
-- Tell the app to run this check again in 5 seconds.
return 0
end idle
on reopen
-- This version uses low-level UI scripting to force the window to the front.
try
tell application "System Events" to tell process "Google Chrome"
perform action "AXRaise" of (first window whose title contains "Chat")
end tell
end try
end reopen
on quit
-- This code runs when you quit the app from the Dock
tell application "Google Chrome"
try
-- Find the window by its title and close it
close (first window whose title contains "Chat")
end try
end tell
continue quit
end quit
@ciriousjoker
Copy link
Author

Nevermind, use this approach:

  • Uninstall Google Chat pwa
  • Go to correct url
  • Enable overrides in the dev tools
  • Override manifest.json with sensible values (for both /u/0 & /u/1)
  • Long press reload button while dev tools are open to empty cache and hard reload
  • Install pwa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment