Skip to content

Instantly share code, notes, and snippets.

@andras-tim
Last active September 9, 2023 13:35
Show Gist options
  • Save andras-tim/d89344b843e9ebaeade5 to your computer and use it in GitHub Desktop.
Save andras-tim/d89344b843e9ebaeade5 to your computer and use it in GitHub Desktop.
Set New Tab background in Google Chrome

Set New Tab background in Google Chrome

  1. Install new-tab-background.user.js UserScript into your Tampermonkey
  2. Edit the UserScript header
  • Set up top-level domain of your country (change .hu to your country's TLD)
  • Change the file:///full/path/of/background.jpg example background URL to your desired URL (if you want to use local resource - `file://`` you have to enable "Allow access to file URLs" right for Tampermonkey)

Check my toolchain what can download & set random wallpaper from Google Image search on Xfce4

// ==UserScript==
// @name New tab background
// @namespace https://www.google.com/
// @version 0.2
// @description Set background of New Tabs
// (the 'file://' source background requires "Allow access to file URLs" right for Tampermonkey)
// @author Andras Tim <[email protected]>
// @homepage https://gist.github.com/andras-tim/d89344b843e9ebaeade5
// @updateURL https://gist.github.com/andras-tim/d89344b843e9ebaeade5/raw/new-tab-background.user.js
// @downloadURL https://gist.github.com/andras-tim/d89344b843e9ebaeade5/raw/new-tab-background.user.js
// @match https://www.google.com/_/chrome/newtab
// @match https://www.google.com/_/chrome/newtab?*
// @match https://www.google.hu/_/chrome/newtab
// @match https://www.google.hu/_/chrome/newtab?*
// @grant GM_addStyle
// @grant GM_getResourceURL
// @resource backgroundImage file:///full/path/of/background.jpg
// ==/UserScript==
/* jshint -W097 */
'use strict';
GM_addStyle("\
body { \
background : url(" + GM_getResourceURL('backgroundImage') + ") no-repeat center center fixed !important; \
background-size : cover !important; \
-webkit-background-size : cover !important; \
} \
#mngb { \
text-shadow : -1px -1px 10px white, -1px 1px 10px white, 1px -1px 10px white, 1px 1px 10px white; \
} \
");
@zhxw-hub
Copy link

zhxw-hub commented Mar 9, 2021

cxvxvxv

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