Skip to content

Instantly share code, notes, and snippets.

@valer-cara
Last active January 31, 2024 15:30
Show Gist options
  • Save valer-cara/1eb1a21ebb5d1c9cf86ebd94f3cc7d0a to your computer and use it in GitHub Desktop.
Save valer-cara/1eb1a21ebb5d1c9cf86ebd94f3cc7d0a to your computer and use it in GitHub Desktop.
I3 scratchpad use. Gamechanger here.

basically Guake (popup terminal), for anything. props to https://faq.i3wm.org/question/138/multiple-scratchpad.1.html

# Resize shortcut: center & set to 80% of height & width of screen.
# Ideal size for quick popups
bindsym $mod+Shift+m resize set 80 ppt 80 ppt; move position center

# Move the focused window to the scratchpad
bindsym $mod+Shift+p move scratchpad

# Individual binds to pop-up selected windows in scratchpad
# You can get the "instance" of a window using "xprop", under WM_CLASS
# It's a 2-value tuple, the first item being the instance, second one the class.
# You can match on any of them, but using Instance here.
# WM_CLASS(STRING) = "emacs", "Emacs"
bindsym $mod+p [instance="emacs"] scratchpad show
bindsym $mod+i [instance="Alacritty-Scratchpad"] scratchpad show

# Alternatively, you can drop the filter by [instance=..] like below
# and i3 will cycle through all the scratchpad windows.
# I used this at first, but per-instance toggles is THE BEST <3
#
# bindsym $mod+p scratchpad show

Note that some programs allow you to customize their Instance/Class names. Eg:

  • alacritty (terminal) -c

Apparently there's wmctrl, an x11-specific tool to set the WM_CLASS, https://superuser.com/questions/692081/how-to-set-instance-name-of-google-chrome-or-any-x11-application. I haven't used it yet.

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