Today I learned about the i3 scratchpad.
The scatchpad is a special i3 window. You can use it as a window that opens your favorite program, e.g., a music player or editor.
Examples:
# Make the currently focused window a scratchpad
bindsym $mod+Shift+minus move scratchpad
# Show the first scratchpad window
bindsym $mod+minus scratchpad show
The first command moves the current window to the scratchpad and makes it invisible. With the second command you open the scratchpad and cycle through all windows. The command opens the window in floating mode.
Set a keyboard shortcut to toggle the floating mode. Example:
bindsym $mod+Shift+space floating toggle
Use the xev command to find the keycode you need for bindsym
.
If you want to add your favorite application as a shortcut, you must know the window class.
Open your favorite application and a terminal window. Inside the terminal, type:
xprop | grep 'CLASS'
Then click on the window of your application.
The output will look like this:
WM_CLASS(STRING) = "chromium", "Chromium"
Now you can use the output to add a bindsym to your i3 config:
bindsym $mod+minus [class="Chromium"] scratchpad show