DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

i3wm Notes


Split Window Freely

Create a new window (split) at the exact place you want, without moving them after created:

bindsym $mod+i split i
bindsym $mod+v split v
bindsym $mod+a focus parent

Compare the following commands:

  • $mod+v $mod+enter $mod+enter, A: upper, B: middle, C: bottom, two horizontal (upside-down) splits

  • $mod+v $mod+enter $mod+i $mod+enter, A: upper, B: bottom-left, C: bottom-right, horizontal split + inside vertical (left-right) split

  • $mod+v $mod+enter $mod+a $mod+i $mod+enter, A: upper-left, B: bottom left, C:right horizontal split + outside vertical split

you will see the flexibility of layout of i3wm.

See section 3. Tree in i3 User’s Guide for examples.

Rename Workspace

bindsym $mod+1 workspace number 1
bindsym $mod+2 workspace number 2
bindsym $mod+3 workspace number 3
bindsym $mod+4 workspace number 4
bindsym $mod+5 workspace number 5
bindsym $mod+6 workspace number 6
bindsym $mod+7 workspace number 7
bindsym $mod+8 workspace number 8
bindsym $mod+9 workspace number 9
bindsym $mod+0 workspace number 10

bindsym $mod+Shift+1 move container to workspace number 1
bindsym $mod+Shift+2 move container to workspace number 2
bindsym $mod+Shift+3 move container to workspace number 3
bindsym $mod+Shift+4 move container to workspace number 4
bindsym $mod+Shift+5 move container to workspace number 5
bindsym $mod+Shift+6 move container to workspace number 6
bindsym $mod+Shift+7 move container to workspace number 7
bindsym $mod+Shift+8 move container to workspace number 8
bindsym $mod+Shift+9 move container to workspace number 9
bindsym $mod+Shift+0 move container to workspace number 10

bindsym $mod+n exec i3-input -F 'rename workspace to "%s"' -P 'New name: '

Now you can rename a workspace with format "#:name", for example, "3:book". And use the number part to switch to it. For example, switch to workspace "3:book" with $mod+3.

i3 arranges the order of all these workspaces in status line. For example, if "3:book" is renamed to "5:website", it will be put from the left to the right side of workspace "4:euler". Hence you can use 3rd workspace as current project. When you need to working on another project, simply rename current project from current to waiting workspace. For example, you wwre working on developing a website, whose workspace named 3:website. Now you need switch to writing your book, whose windows are all in workspace #6. Rename 3:website to 7:website, and 6 to 3:book.

To persist the workspace names, run the following script:

i3-msg 'rename workspace 3 to 3:book'
i3-msg 'rename workspace 4 to 4:euler'
i3-msg 'rename workspace 5 to 5:website'
i3-msg 'rename workspace 6 to 6:misc'
i3-msg 'rename workspace 7 to 7:biot'
i3-msg 'rename workspace 8 to 8:note'
i3-msg 'rename workspace 9 to 9:reading'
i3-msg 'rename workspace 10 to 10:servers'

See section 6.8 Changing (named) workspaces/moving to workspaces, especially 6.8.2 "Named workspaces" for details.

Use GUI with Scratchpad

Scratchpad is an invisible workspace. Move a window to it with command move scratchpad (thus it's hidden). Show it again (move it out of scratchpad) with command scratchpad show. When more than one window are moved into scratchpad, it's inconvenient to use scratchpad show multiple times to show the window you want. So you can add a window prefix before this command to show specific window.

Example configurations:

bindsym $mod+Shift+BackSpace move scratchpad
bindsym $mod+BackSpace scratchpad show
bindsym $mod+equal [class="Firefox"] scratchpad show

To find the window class of an application, run command xprop | grep WM_CLASS in a console, and click the target application to print its window class name.

Scratchpad is useful for mouse-centred GUI applications. It's not a good idea to use it for managing console applications.

it's a better solution to assign a fixed workspace for specific applications. For example, #1 workspace is for Chrome browser, #2 for Firefox browser, #8 for note-taking application, such as donno, dsnote.



Published

Dec 12, 2018

Last Updated

Nov 2, 2020

Category

Tech

Tags

  • i3wm 6
  • window 5
  • xprop 1

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor