Skip to content

Instantly share code, notes, and snippets.

@solidgoldpig
Last active November 7, 2024 01:50
Show Gist options
  • Save solidgoldpig/c2561e13e2982ab0a98d3cd1fbf3cb74 to your computer and use it in GitHub Desktop.
Save solidgoldpig/c2561e13e2982ab0a98d3cd1fbf3cb74 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name SGP Mail
// @namespace http://solidgoldpig.com/userscripts/sgp-mail
// @version 0.1
// @description Make Gmail more bearable
// @author [email protected]
// @match https://mail.google.com/*
// @grant none
// ==/UserScript==
/* jshint ignore:start */
(function () {
'use strict'
var labelsToIgnore = [
'csslayout',
'cwjobs',
'jobs',
'node-js',
'wsg-announce',
'w3c-training',
'logcheck',
'[email protected]'
]
var searchList = `label:unread ${labelsToIgnore.map((l) => '-label:' + l).join(' ')}`
function showUnread () {
document.querySelector('input[aria-label^="Search"]').value = searchList
document.querySelector('button[aria-label^="Search"]').click()
}
const intervalID = setInterval(function () {
if (window.Shortcut) {
window.Shortcut.add('Meta+Shift+u', showUnread)
clearInterval(intervalID)
}
}, 10)
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment