How to Use Scratchpads on i3

Поділитися
Вставка
  • Опубліковано 2 лют 2025

КОМЕНТАРІ • 59

  • @phonewithoutquestion80
    @phonewithoutquestion80 2 роки тому +4

    I was JUST NOW trying to optimize my scratchpad usage. Thank you for making this video.

  • @electrodav3878
    @electrodav3878 2 роки тому +11

    When you use the `exec_always` method at minute 11:28, you can easily fix the multiple instances' problem through the following command:
    exec_always --no-startup-id pgrep -f '^alacritty --class ttrm,ttrm' || alacritty --class ttrm,ttrm
    In this way, if an alacritty instance with the given class is still running, no more instances will be created.
    You can easily extend this method to the other classes you use in your config.
    Cheers

    • @TheLinuxCast
      @TheLinuxCast  2 роки тому

      That's awesome. I'll give it a try.

  • @xwinglover
    @xwinglover 2 роки тому +5

    I agree Matt, the scratchpad is so useful to me. Especially when I can hide it, and call it into any of the other workspaces.

  • @loganbashore
    @loganbashore 2 роки тому +1

    Hey Matt, so as you said at 4:11, you mentioned you still haven't been able to move your scratchpad bindings over to sxhkd and I noticed by looking at your GitLab that you still haven't found a way to change it. Luckily, I found a pretty simple way that I hope can help you!
    You can move all of your "bindsym *keybind* [class="*class*"] scratchpad show; move position center" bindings into sxhkd by replacing the bindsym command as well as the keybind with "i3-msg" and put that into the sxhkdrc file. So, as an example for your pulsemixer scratchpad, the added lines in your sxhdrc file should look like this:
    # Pulsemixer
    super + b
    i3-msg [class="pulse"] scratchpad show; move position center
    I hope this helps! Also, I just wanna say I really appreciate the videos. They've helped out so much and have taught me a lot on how to just make things work, specifically for the scratchpads as well as for polybar. I think my Linux journey would've been much harder if it wasn't for your videos so I genuinely thank you for getting these videos out as much as you do because it hasn't just helped me, but it's definitely helped many other people as well!

  • @rmcellig
    @rmcellig 2 роки тому +1

    You are such a great teacher and I appreciate that everytime I watch one of your videos! Love this video. Thanks!!! 😀

  • @kj-marslander
    @kj-marslander 2 роки тому

    I don't see many i3wm turorials anymore. Great video! i3wm is the only tiling wm I like. Please make more tutorials like this.

  • @Maik.iptoux
    @Maik.iptoux 2 роки тому +1

    Minute 12: is it not possible to include an if condition before the exec_always? So you can check if it is already running? Maybe you can check if an pid is there. Or add an Titel and check if scratchpad with given Titel is already running. Titles can be "sc1,sc2,sc3" or something like that. This must be possible i think, you can outsource the if conditions and exec of terminal in an own script and call the script in the config -> persist scratchpad in i3 born and available for all 🤔 Just an idea.

  • @keyboardwarrior6296
    @keyboardwarrior6296 2 роки тому

    If you place the window you want as a scratchpad in an empty workspace and change it to tabbing mode before turning it into a scratchpad, you can have all of your scratchpad programs in the same tabbed parent window, and new windows will spawn in the tabbed window when it is focused.
    Instead of cycling through windows, you can have them in one convenient place.

    • @TheLinuxCast
      @TheLinuxCast  2 роки тому

      That's a neat trick. I don't use tabs as much as I used too. Should get back to doing that.

  • @user-gp8ub8vh7i
    @user-gp8ub8vh7i 2 роки тому

    Matt, here is the segment of my i3 config with the scratchpads. I can quit them and the windows and bring them back without restarting i3. Actually the first two commands are enough. You can open several terminal windows with a program in each, say ranger, ncmpcpp, pulselmixer, then convert the windows to tabbed and send each to scratchpad with mod+Shift+minus (or whatever keybinding you want) and cycle through them in any space with mod+minus:
    # SCRATCHPADS
    # Make the currently focused window a scratchpad
    bindsym $mod+Shift+minus move scratchpad
    # Show the first scratchpad window
    bindsym $mod+minus scratchpad show
    bindsym $alt+Shift+z exec st -n scratch -e ncmpcpp
    bindsym $alt+z [instance="scratch"] scratchpad show
    bindsym $alt+Shift+c exec st -n ranger -e ranger
    bindsym $alt+c [instance="ranger"] scratchpad show
    # make scratchpads windows floating
    for_window [instance="scratch"] floating enable
    for_window [instance="scratch"] resize set 1000 600
    for_window [instance="scratch"] move scratchpad
    for_window [instance="scratch"] border pixel 10
    for_window [instance="ranger"] floating enable
    for_window [instance="ranger"] resize set 1000 600
    for_window [instance="ranger"] move scratchpad
    for_window [instance="ranger"] border pixel 10
    # END OF SCRATCHPADS
    BTW, nice video and channel. Keep the good work!

    • @rodoxplo
      @rodoxplo 2 роки тому

      Great comment; btw the function exec st -n doesn't do anything; any thought?

  • @ZelenoJabko
    @ZelenoJabko Рік тому

    Very cool! Trying to set it up on Sway, wish me luck.

  • @georgelabonte2258
    @georgelabonte2258 2 роки тому

    Great video.
    I noticed all the scratchpads where using alacritty. Can you also just use a gui text editor like gvim, and specify a file?
    I've been looking for a way to be able to call up a floating window to display a specific text file, like a listing of i3 key bindings. I think a scratchpad might do the trick, but not sure how to configure it. The scratchpad section in the i3 user's guide needs a bit of work.

  • @dvox4361
    @dvox4361 2 роки тому

    Hi Matt, how to find out the CLASS type of applications running inside the terminal (like pulsemixer, etc)? Whenever use xprop on the application window it shows me Alacritty for both class types, but not the application...

    • @TheLinuxCast
      @TheLinuxCast  2 роки тому

      As far as I know, apps that run in the terminal, don't have their own classes. But Alacritty has a way to set the class, so if you're looking to have a pulsemixer window, you could launch it with alacritty --class pulsemixer,pulsemixer -e pulsemixer

    • @dvox4361
      @dvox4361 2 роки тому

      @@TheLinuxCast Thanks for your fast reply! I'm looking to have a Pulsemixer scratchpad window (similar to yours), but your config doesn't work for me. I'll keep trying! Best regards from Germany!

    • @MarkDymek
      @MarkDymek 4 місяці тому

      you no longer need to do that. just type the name of the program.

  • @jonnywester3194
    @jonnywester3194 2 роки тому

    Thank you soo much for this!! Helped me alot!

  • @sgarrison05
    @sgarrison05 2 роки тому

    I am not a Linux newbie, but this is very confusing. I can not for the life of me get the scratchpad to work. There is no problem understanding the bindsym part or the exec part. I feel the problem that I am specifically having is with the class. I can get the class of the window, but that only points to the terminal (usually) and not the specific cli program or application I am trying to bring up (i.e. news, fm, ttrm, pulse, etc). where are you getting that class information? xprop only gives me the terminal window. What am I missing? Also when do you use -e flag or not?

    • @SilverSeleucid
      @SilverSeleucid 9 місяців тому

      ran into this exact issue, using these bindings seem to just recenter an existing floating window but not open pulsemixer (which i have) nor can i find the class for it. have you figured this out since you posted this a year ago or did you move on to another solution?

    • @sgarrison05
      @sgarrison05 8 місяців тому

      @@SilverSeleucid I figured it out. It turned out I could not spell scratchpad very well. I was missing the “t”. Yanking the mistake vim and repeating it didn’t help.

  • @wisnoskij
    @wisnoskij 2 роки тому

    That in interesting. But that does mean that these programs are always running even when you are not using them. Would it not just be more efficient to have that same keybinding start and stop the program? Or maybe hardware has advanced to the point where extra memory and threads are less important that not overusing your SSD?

    • @TheLinuxCast
      @TheLinuxCast  2 роки тому +1

      The things I have open I use dozens of times a day, so keeping them open makes sense.

  • @IuliusPsicofactum
    @IuliusPsicofactum 2 роки тому

    I used the i3 scratchpad a lot at work to have my broswer with my social media hidden and quickly call it between tasks to check on stuff :P

  • @thenextpoetician6328
    @thenextpoetician6328 2 роки тому +1

    Big scratchpad fan here as well. Still twiddling with how I prefer the setup, and really too bad Budlabs isn't into gaps. His i3 is very cool and completely foreign to any other setup I've seen.

  • @androth1502
    @androth1502 2 роки тому

    hm. my arcolinux has by default F12 set to open the terminal in a scratchpad, and it seems to work consistently on almost all the various DEs and TLMs that it installs and i've tried. does this mean it has a separate setup for this on every single supported environment or does it use some 3rd party package?
    the terminal is probably the only thing i would want on scratchpad and one thing i have on conemu on windows. i can't live without it. heh.

    • @TheLinuxCast
      @TheLinuxCast  2 роки тому

      That's only if you use arcos config. I do not.

    • @androth1502
      @androth1502 2 роки тому

      @@TheLinuxCast i'm only a few weeks into linux so all this is new to me. i would like to be able to set this up on anything since i'm considering nuking win 10 on my laptop and installing fedora. still undecided on which distro/env to setup. i have arco on a desktop but i don't use that desktop much. i'm getting too much choice burn. lol.

    • @androth1502
      @androth1502 2 роки тому

      addendum: xfce4-terminal has a --drop-down option which effectively gives it a built in scratchpad.

  • @modelkitbeginner
    @modelkitbeginner 2 роки тому

    Am I late? - I am late ....
    Thank you very much ! This got me thinking and I didn't quite get it right the way you did it. So here is my alternative which appears to work:
    exec tilix --name dropdown
    bindsym $mod+F11 [instance="dropdown"] scratchpad show; move position center
    exec youtube-music --name youtube
    bindsym $mod+F10 [instance="youtube"] scratchpad show; move position center
    # Dropdown
    for_window [instance="dropdown"] floating enable
    for_window [instance="dropdown"] resize set 1000 600
    for_window [instance="dropdown"] move scratchpad
    for_window [instance="dropdown"] border pixel 5
    # UA-cam
    for_window [instance="youtube"] floating enable
    for_window [instance="youtube"] resize set 1000 600
    for_window [instance="youtube"] move scratchpad
    for_window [instance="youtube"] border pixel 5
    Once changes are done log out and back in. I scratched that together from several websites and videos but yours got the ball rolling. Cheers bud - appreciate it.

  • @Klej0aka0Klej
    @Klej0aka0Klej 2 роки тому

    It doesn't work like it should for me and i am not sure what i am doing wrong:
    In my config i got: `bindsym $mod+b [class="Alacritty"] scratchpad show; move position center` and it only moves my window to the center but like scratchpad doesn't work, it doesn't hide it or anything
    //nvm, tbh you should say that there needs to be also move scratchpad in my config for that window also

    • @TheLinuxCast
      @TheLinuxCast  2 роки тому

      That's because I don't use it that way. Your binding there will make ever alacritty terminal a scratchpad. The way I show gives one terminal a new class.

    • @Klej0aka0Klej
      @Klej0aka0Klej 2 роки тому +1

      @@TheLinuxCast I totally agree with that you said, I just didn't know that I also need to have like "move scratchpad" in my config for specified classes. Since you didn't show that in your video, and it's in your other file in config, it was a surprise for me :) that's it.

  • @PremierSullivan
    @PremierSullivan 2 роки тому

    Why does i3-not-gaps still exist? You can turn off the gaps with a config. Would be nice if we could consolidate on one version.

    • @TheLinuxCast
      @TheLinuxCast  2 роки тому +2

      The dev of regular i3 has always been against adding gaps, though I read that that might be changing.

    • @PremierSullivan
      @PremierSullivan 2 роки тому

      @@TheLinuxCast I hope so

    • @kj-marslander
      @kj-marslander 2 роки тому

      I think I read somewhere on the "i3-not-gaps" (lol) dev's github that he doesn't like the code used to make i3gaps, he thinks the code is messy or something, idk.

  • @Froggie92
    @Froggie92 2 роки тому +1

    i never thought to split my i3/config, brb
    also dracula 🧛‍♂️🧛‍♂️
    double also, where are your dotfiles, i want to check your bar config

  • @iusearchbtw4969
    @iusearchbtw4969 Рік тому +1

    Doesn't work for me

    • @MarkDymek
      @MarkDymek 4 місяці тому

      this video is outdated. check the i3 manual.

  • @vxer
    @vxer 2 роки тому

    Good dotfiles

  • @Prophet6000
    @Prophet6000 2 роки тому

    I need to get that music player working.

  • @arsacode6145
    @arsacode6145 Рік тому

    Christmas is there for me whenever I want it is right xD

  • @AnalyticMinded
    @AnalyticMinded 2 роки тому +1

    19 workspaces, multi-monitor, and 6 scratchpads... my question is, how many cups of coffee a day?! :P

  • @MrCradleman
    @MrCradleman 2 роки тому

    In sway I use one keybinding for show scratchpad or open application if show scratchpad doesn't work. See odysee comment

    • @TheLinuxCast
      @TheLinuxCast  2 роки тому

      Jake@Linux does something similar, I think

  • @NaurisMich
    @NaurisMich 26 днів тому

    Is it still a thing? I can't get it work in 2025

    • @TheLinuxCast
      @TheLinuxCast  26 днів тому

      I'm not sure. I use a script that uses xdotool to create scratchpads. It's more flexible.

    • @NaurisMich
      @NaurisMich 25 днів тому

      @@TheLinuxCast I'll give a try. Thanks

  • @MarkDymek
    @MarkDymek 4 місяці тому

    this is outdated you no longer need to have a separate exec to open a scratchpad. you also do not need to know the class name. the docs have instructions on how to do it.

  • @Thaleios
    @Thaleios 2 роки тому +2

    Wait, you're a nerd? No way! 🙂

    • @TheLinuxCast
      @TheLinuxCast  2 роки тому +3

      Well it was either hand model or nerd, and nerd seemed like the way to go. LOL

    • @Thaleios
      @Thaleios 2 роки тому

      @@TheLinuxCast Haha! Same here. Modeling is overrated. :-)

  • @1987slide
    @1987slide Рік тому

    i made a quick script to create the scratchpad and then show it if it isn't running or just show it if its is running
    (if that makes sense), DISCLAIMER: i am a noob when it comes to scripting so feel free to point out any obvious mistakes
    the script (i3-scratchpad), replace ranger with the application you want:
    #!/bin/bash
    APP="alacritty --class $1,$1 -e $1"
    CHECK=$(pgrep -f "$APP")
    [[ -z $CHECK ]] && $APP &
    while [[ -z $CHECK ]]; do
    sleep 0.1
    CHECK=$(pgrep -f "$APP")
    done
    i3-msg [class=$1] scratchpad show
    the config:
    for_window [class="ranger"] floating enable
    for_window [class="ranger"] move scratchpad
    bindsym $mod+b exec --no-startup-id i3-scratchpad ranger