Finally, I got to do what I like the most which is the very reason why I started and still love to write code: solve some nasty issues I've always had in my day-to-day life.
Have you ever wondered where the hell your browser's tab with your meet call got lost in the chaos of all the opened tabs you have? Or did you ever get out from a meeting as simple as pressing "f5" or "cmd+r"?
I did 😅 and I thought I could do something about it.
I've created a Google Chrome extension called "Unconventional Meet" (Italian people will get the joke! For foreigners, Unconventional is a "fake meat" brand like Beyond).
Install it from the Chrome web store or take a look at the implementation in the Github repository.
The existing Google Meet enhancers
There are already a lot of Chrome extensions to enhance your Google Meet experience, but none that I am aware of is offering the possibility to pop up a confirmation alert before exiting a meeting, not even paid ones.
Furthermore, I had fun, it's free, and it's open source... so there is plenty of good reasons why this thing exists!
The features the extension allows you to opt-in are 3 (at least for now):
1. Auto-join meetings when reaching Meet's waiting room.
2. Ask for confirmation when closing the tab, whether you wanted to close it or not (be aware that the alert doesn't appear if you pressed Google Meet's red button to close the call).
3. Make the google meet tab active when you press the extension, for those cases where you lost it or simply have too many tabs that are just too small to be easily clicked!
I do believe the implementation of all three features is quite fragile but should just work fine and I have to admit that having explored a bit the ways and habits of Chrome extensions development, there is definitely much much worse out there 😵
To achieve the auto-join functionality, I've tried a couple of things but got tired in the end and went with the dumbest/easiest solution. Luckily the class name of the join button seems to be always the same, the only pity is that I couldn't use any MutationObserver watching the DOM because no event appears to be related to the join button.
In addition to that, if I were to programmatically click the button as soon as the element was found in the DOM, for some reason the click wasn't working.
For these reasons, I ended up spawning an interval every 1 second that finds the button and clicks it for five times... no matter what, no matter where.
Call me Bob the Builder:
Asking for confirmation when closing the tab, instead, was very hard to get right, especially because there is some sort of protection mechanism built inside Chrome extensions' sandbox that doesn't allow you to set a beforeunload handler (e.g. a function that gets executed when a tab is closed) if there haven't been interactions on the page yet.
In a normal use case the end-user should be fine, but to discover this while you're entering Meet rooms just to test the code you wrote, I assure you it gives you headaches.
This was luckily easy to achieve. The objective was that with a click on the extension, the first Chrome tab that is running Google Meet should gain focus (if there is any).
Sadly, though, Chrome doesn't allow for an extension pop-up to stay open after a tab loses focus (source) and I didn't like the alternatives to circumvent this problem (see point number 4)
The algorithm I implemented works in this way:
- The user clicks on the extension
- The extension asks Chrome what's the index of Google Meet's tab
- The extension's pop-up will display for very few milliseconds
- If Google Meet's tab was found, then it will be focused and for the reason above chrome will shut down the extension's popup, if not the extension's pop-up will be rendered just fine.
- If Google Meet's tab was found and it gained focus or simply Google meet's tab is active, now you can click a second time the extension and it will just render the extension's pop-up.
I honestly don't see all this as a real issue. Ideally, once you've opened the pop-up and configured the extension, you will not need to open it back again.
Thank you if you've reached the end. I hope some of you will find this work useful or that at least could get inspired by it.
I'm also very happy I've been able to write this post... you know, some bad things happened in the last couple of months and the fact that I haven't been able to push hard like I usually do in my work field made me disappointed, frustrated, and sad among the other troubles I'm dealing with.
Just know that the first commit for this was done almost exactly one year ago 🤦♂️
Hoping for better days ahead, I wish you the best ✌️