If you've used i3 or Sway, you may be familiar with their concept of a "scratchpad", which allows showing/hiding an application as a floating, centered window with a global shortcut.
This interaction model is ideal for applications you engage with often but briefly. Scratchpads allow you to summon group messaging, email clients, calendars, or a terminal window instantly from any workspace, and then quickly dismiss it to get back to what you were doing before.
This extension brings that functionality to Gnome.
Clone or copy the contents of this repo to:
$HOME/.local/share/gnome-shell/extensions/[email protected]
Before enabling the extension, you'll need to create an initial configuration located at:
$HOME/.config/gnome-scratchpad/config.json
Here's an initial example to get started:
{
"window_width": 1800,
"window_height": 1200,
"hide_keybind": "<super>n",
"bindings": [
{ "wmclass": "^Slack$", "keybind": "<super>i" },
{ "wmclass": "^kitty$", "keybind": "<super>Return" }
]
}
Some of the options are self-explanatory, but we'll cover all of them for good measure:
window_(width|height)
: width/height to which the window will be resized when shownhide_keybind
: keybind used to hide all visible scratchpad windowsbindings
: array of rule + shortcut configurations for your scratchpad appswmclass
: regex used to target a window based on its classtitle
: regex used to target a window based on its titlekeybind
: shortcut in[<Modifiers>+]<keycode>
notation
Note
You only need to specify wmclass
or title
. Of the two, wmclass
is
generally more useful, since windows often change their titles based on content.
If you specify both, they'll form a logical OR, with wmclass
taking precedence.
If multiple windows match the criteria, the first window will be used.
The easiest way to find a wmclass
value for the window you're trying to target
is to use Gnome's "looking glass" feature, which allows inspecting aspects of
Gnome shell; here's how to use it:
- Make sure the app/window you're trying to identify is running/open
- Open Gnome's "run command" prompt (
Alt+F2
by default) - Type
lg
(for "looking glass") and hit enter - A panel opens with buttons on the top right; click the "Windows" button
- Find the app you're trying to target and make note of its
wmclass
attribute value
Gnome reserves certain keybinds by default; some of these can be cleared, but
others can't. When choosing a keybind, make sure it's not already assigned to
something in Settings > Keyboard > Keyboard Shortcuts > View and Customize Shortcuts
.
If it is, disable the shortcut or assign it to another keybind.
The two most common configuration issues you're likely to encounter are:
- the
keybind
you're trying to use is unavailable/reserved by Gnome - the
wmclass
ortitle
isn't matching any windows
You can diagnose both of these pretty easily by:
- Opening Gnome's "Logs" application
- Clicking the "All" category on the left side to show all messages
- Using the search function to filter messages containing "gnome-scratchpad"
The extension logs success/failure states when setting up keybinds, as well as lookup failures when a keybind is handled but a matching window can't be found.
Tip
The configuration file is only loaded once, when the extension is initially enabled. If you are making changes to it, you can toggle the extension in the Gnome extensions app to forcibly reload the configuration.
If none of your keybinds are working, check the extensions app. It's possible your configuration file isn't valid JSON, which will prevent the extension from starting. If that's the case, you'll see an error displayed underneath the extension name.
Having instant access to applications from any workspace is useful, but scratchpads really shine when paired with website "applications", or more specifically, site-specific browser windows. You can configure Chrome/Chromium to open a website in a dedicated window and then assign a keybind to that window. This makes it possible to quickly interact with sites like Todoist, DevDocs, Google Calendar, or anything else that is either unavailable as a native app or that you'd simply prefer to not install locally.
Note
This functionality is currently limited to Chrome/Chromium. It was previously available in Firefox, but was removed in v86.
You can create a shell script to run a website as an app like so:
#!/bin/sh
APP_NAME="todoist"
chromium --user-data-dir="$HOME/.config/$APP_NAME" --app=https://$APP_NAME.com
Running that will allow you to target the window using the following bindings
entry:
{ "wmclass": "^chrome\\-todoist\\.com", "keybind": "<super>t" }
While that works, launching the script from a terminal isn't ideal. To solve that,
add the following contents to a new $HOME/.local/share/applications/todoist.desktop
file:
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Todoist
Comment=Todoist Chromium Web Application
Exec=/path/to/todoist/script/above
Icon=application.png
Terminal=false
Once Gnome indexes that, you'll be able to launch Todoist from the overview
screen and access it instantly from any workspace by hitting Super + t
.