Skip to content

Instantly share code, notes, and snippets.

@Xorlev
Last active December 24, 2015 10:09
Show Gist options
  • Save Xorlev/6782000 to your computer and use it in GitHub Desktop.
Save Xorlev/6782000 to your computer and use it in GitHub Desktop.
Kato.im Fluid.app userscript to update the dock badge with the # of unread messages.
// ==UserScript==
// @name Kato.im Fluid Dock Badge
// @description Displays the unread count of messages, adapted from http://userscripts.org/scripts/review/177616
// @author Michael Rose
// ==/UserScript==
window.fluid.dockBadge = '';
setTimeout(updateDockBadge, 1000);
setTimeout(updateDockBadge, 3000);
setInterval(updateDockBadge, 5000);
function updateDockBadge() {
var newBadge = '';
var totalCount = parseInt($(".badge").html());
if (totalCount > 0) {
newBadge = '' + totalCount;
}
window.fluid.dockBadge = newBadge;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment