-
-
Save MaherSaif/90441999d8b35ccbd14163a13163ec0c to your computer and use it in GitHub Desktop.
Start a new Google Meet and put the link on your clipboard (Hyprland + Chromium)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # meet-new — start a new Google Meet and put its link on the clipboard. | |
| # | |
| # https://meet.google.com/new redirects to the real meeting URL, but that | |
| # happens inside the browser, so the code never reaches us directly. Chromium | |
| # does put it in the window title though ("Meet - abc-defg-hij"), and Hyprland | |
| # hands us those titles, so we poll for a code that was not on screen before we | |
| # launched and rebuild the URL from it. | |
| set -euo pipefail | |
| readonly TIMEOUT=${MEET_NEW_TIMEOUT:-45} | |
| readonly CODE_RE='[a-z]{3}-[a-z]{4}-[a-z]{3}' | |
| visible_codes() { | |
| hyprctl clients -j | jq -r '.[].title' | grep -oE "$CODE_RE" | sort -u | |
| } | |
| # Meetings that were already open are not the one we are about to create. | |
| before=$(visible_codes || true) | |
| before_file=$(mktemp) | |
| trap 'rm -f "$before_file"' EXIT | |
| printf '%s\n' "$before" >"$before_file" | |
| omarchy-launch-webapp "https://meet.google.com/new" | |
| code="" | |
| deadline=$((SECONDS + TIMEOUT)) | |
| while ((SECONDS < deadline)); do | |
| code=$(visible_codes | grep -vxF -f "$before_file" | head -1 || true) | |
| [[ -n $code ]] && break | |
| sleep 0.5 | |
| done | |
| if [[ -z $code ]]; then | |
| notify-send -u critical -a Meet "No meeting link found" \ | |
| "The Meet window did not show a meeting code within ${TIMEOUT}s." | |
| exit 1 | |
| fi | |
| url="https://meet.google.com/$code" | |
| printf '%s' "$url" | wl-copy | |
| notify-send -a Meet "Meeting link copied" "$url" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment