Skip to content

Instantly share code, notes, and snippets.

@tordans
Forked from itod/fluid_gmail.js
Last active November 9, 2018 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tordans/85cbaa856b93b52e9a1465004569218e to your computer and use it in GitHub Desktop.
Save tordans/85cbaa856b93b52e9a1465004569218e to your computer and use it in GitHub Desktop.
Gmail Fluid App Userscript
// use for patterns:
// *gmail.com*
// *mail.google.com*
// *google.com*mail*
// Initialize Badge so we see that this works
window.fluid.dockBadge = 99;
// Updater
setTimeout(updateDockBadge, 1000);
setTimeout(updateDockBadge, 3000);
setInterval(updateDockBadge, 5000);
function updateDockBadge() {
// Extract unread message count from title and set dockBadge
// There is no "Inbox" in this regex to work around different gmail-languages.
var regex = /\s*\((\d+)\)[^\d]*/;
window.fluid.dockBadge = document.querySelector('title').textContent.match(regex)[1];
}
@joshuapinter
Copy link

FYI, this is no longer necessary with Version 2+ of Fluid.

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