How to Use Scratchpads on i3

แชร์
ฝัง
  • เผยแพร่เมื่อ 4 ส.ค. 2024
  • Today I talk about how to use scratchpads on i3wm. i3 is one of the best window managers out there. Scratchpads just make it so much better.
    👇 PULL IT DOWN FOR THE GOOD STUFF 👇
    Patreon - / thelinuxcast
    Liberapay - liberapay.com/thelinuxcast/
    TH-cam - / @thelinuxcast
    ===== Follow us 🐧🐧 ======
    Odysee - odysee.com/$/invite/@thelinux...
    Mastadon - @drmdub@distrotoot.com
    / thelinuxcast
    / mtwb
    Discord - / discord
    gitlab.com/thelinuxcast
    Subscribe at thelinuxcast.org
    Contact us email@thelinuxcast.org
    Telegram Group - t.me/+9lYoIuLh0JIyMzcx
    Amazon Wishlist - www.amazon.com/hz/wishlist/ls...
    Merch Store - zaney.creator-spring.com/
    Logo Courtesy of - pedropaulo.net
    ==== Referenced ====
    ‪@JakeLinux‬ Channel - / @jakelinux
    ===== Thanks to Our Patrons! ====
    Tier 7 - Tux Level - Patrons
    Robert M.
    Tier 5 Patrons
    Syd A.
    Tier 4 Patrons
    Devon, Patrick, Fred, Kramer K.
    Tier 3 Patrons
    Maeglin, Jackson Knife and Tool, Steve A, CyberGuyLinux, Garrick, Samuel, KB, TGB
    Tier 2 Patrons
    Mitchel, Joris AKA JDawg, carnondated, Shaun, Jeremy, Odin, Martin, Andy P., Ross, Eduardo S.
    Tier 1 Patrons
    Marek, Camp514, Joshua Lee, Peter, Crucible, Darkbadits6, Primus, PM
    #i3 #tut #thelinuxcast
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 53

  • @phonewithoutquestion80
    @phonewithoutquestion80 2 ปีที่แล้ว +4

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

  • @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.

  • @electrodav3878
    @electrodav3878 2 ปีที่แล้ว +10

    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.

  • @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!!! 😀

  • @iHateStupidUserName
    @iHateStupidUserName ปีที่แล้ว +1

    Thank you Matt for showing this cool feature! Its also cool to see how organized your i3wm config. One thing that would have made the intro to the scratchpad feature better: is to include the config that actually sets up the scratchpad "workspace". Anyhow did find it in your dotfiles:
    ```
    for_window [class="pulse|ttrm|mus|fm"] floating enable, resize set 1000 600, move scratchpad, border pixel 0
    ```

  • @itsemermer
    @itsemermer 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!

  • @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.

  • @jonnywester3194
    @jonnywester3194 ปีที่แล้ว

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

  • @ZelenoJabko
    @ZelenoJabko ปีที่แล้ว

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

  • @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?

  • @Maik.iptoux
    @Maik.iptoux ปีที่แล้ว +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.

  • @georgelabonte2258
    @georgelabonte2258 ปีที่แล้ว

    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.

  • @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.

    • @TheLinuxCast
      @TheLinuxCast  2 ปีที่แล้ว +2

      Agreed. i3run was perfect.

  • @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

  • @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
    # TH-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.

  • @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.

  • @vxer
    @vxer ปีที่แล้ว

    Good dotfiles

  • @arsacode6145
    @arsacode6145 11 หลายเดือนก่อน

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

  • @Prophet6000
    @Prophet6000 2 ปีที่แล้ว

    I need to get that music player working.

  • @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.

  • @dvox4361
    @dvox4361 ปีที่แล้ว

    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  ปีที่แล้ว

      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 ปีที่แล้ว

      @@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!

  • @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.

  • @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

  • @AnalyticMinded
    @AnalyticMinded 2 ปีที่แล้ว +1

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

  • @sgarrison05
    @sgarrison05 ปีที่แล้ว

    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 2 หลายเดือนก่อน

      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 2 หลายเดือนก่อน

      @@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.

  • @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.

  • @iusearchbtw4969
    @iusearchbtw4969 9 หลายเดือนก่อน +1

    Doesn't work for me

  • @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.

  • @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

  • @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