Skip to content

Instantly share code, notes, and snippets.

@malcolmocean
Created October 27, 2020 22:54
Show Gist options
  • Save malcolmocean/d0070cac86890d5c09fd4da1f80ba571 to your computer and use it in GitHub Desktop.
Save malcolmocean/d0070cac86890d5c09fd4da1f80ba571 to your computer and use it in GitHub Desktop.
Fix Godawful New Google app icons
// ==UserScript==
// @name Google - restore old favicons
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Google fucked up its icons. This unfucks them. See this tweet:
// https://twitter.com/Malcolm_Ocean/status/1316828432483979272
// @author @Malcolm_Ocean
// @match https://mail.google.com/*
// @match https://drive.google.com/*
// @match https://calendar.google.com/*
// @grant none
// ==/UserScript==
/* known issues
- icons could probably be nicer
- only supports these 3 apps, which are the ones I use (/photos didn't change as much)
- google calendar no longer has date in icon, but let's face it it's not readable in the new one anyway so,,,
*/
(() => {
'use strict'
const hostToIconMap = {
'mail.google.com': 'https://iconarchive.com/download/i95298/dtafalonso/android-l/Gmail.ico', // 'https://upload.wikimedia.org/wikipedia/commons/thumb/a/ab/Gmail_Icon.svg/1280px-Gmail_Icon.svg.png',
'drive.google.com': 'https://www.flaticon.com/svg/static/icons/svg/733/733554.svg',
'calendar.google.com': 'https://img.icons8.com/color/452/google-calendar.png',
}
const iconUrl = hostToIconMap[location.host]
// querySelectorAll because GCal has multiple elements
// multiple selectors because different google apps use different attribute
const faviconElements = document.querySelectorAll('[rel="shortcut icon"], [rel="icon"]')
faviconElements.forEach(elem => {elem.href = iconUrl})
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment