23

I am trying to set up my computer (running Crunchbang Linux Waldorf and i3) so that it is always, by default, configured so that pressing Ctrl + Shift and arrow keys resizes the window according to the direction of the arrows.

The i3 user guide provides this example which I think is very close to what I want:

mode "resize" {
    # These bindings trigger as soon as you enter the resize mode

    # Pressing left will shrink the window’s width.
    # Pressing right will grow the window’s width.
    # Pressing up will shrink the window’s height.
    # Pressing down will grow the window’s height.
    bindsym j           resize shrink width 10 px or 10 ppt
    bindsym k           resize grow height 10 px or 10 ppt
    bindsym l           resize shrink height 10 px or 10 ppt
    bindsym semicolon   resize grow width 10 px or 10 ppt

    # same bindings, but for the arrow keys
    bindsym Left        resize shrink width 10 px or 10 ppt
    bindsym Down        resize grow height 10 px or 10 ppt
    bindsym Up          resize shrink height 10 px or 10 ppt
    bindsym Right       resize grow width 10 px or 10 ppt

    # back to normal: Enter or Escape
    bindsym Return mode "default"
    bindsym Escape mode "default"
}

# Enter resize mode
bindsym $mod+r mode "resize"

But I want to build it in natively, without having to enter and exit resize modes. I just want to use arrow keys, not J,K,L and ; keys.

Any thoughts on how I would do that?

19

Best solution that I have figured out myself:

Go to ~/.i3/config and open the file.

Paste following code at the end:

bindsym $mod+Ctrl+Right resize shrink width 1 px or 1 ppt
bindsym $mod+Ctrl+Up resize grow height 1 px or 1 ppt
bindsym $mod+Ctrl+Down resize shrink height 1 px or 1 ppt
bindsym $mod+Ctrl+Left resize grow width 1 px or 1 ppt

Save it and restart i3.

| improve this answer | |
6

Base on the @Oposum's solution, I added a "fast resize" :

# Resizing windows by 10 in i3 using keyboard only
bindsym $mod+Ctrl+Shift+Right resize shrink width 10 px or 10 ppt
bindsym $mod+Ctrl+Shift+Up resize grow height 10 px or 10 ppt
bindsym $mod+Ctrl+Shift+Down resize shrink height 10 px or 10 ppt
bindsym $mod+Ctrl+Shift+Left resize grow width 10 px or 10 ppt

So in my ~/.i3/config I have:

# Resizing windows in i3 using keyboard only
# https://unix.stackexchange.com/q/255344/150597

# Resizing by 1
bindsym $mod+Ctrl+Right resize shrink width 1 px or 1 ppt
bindsym $mod+Ctrl+Up resize grow height 1 px or 1 ppt
bindsym $mod+Ctrl+Down resize shrink height 1 px or 1 ppt
bindsym $mod+Ctrl+Left resize grow width 1 px or 1 ppt

# Resizing by 10
bindsym $mod+Ctrl+Shift+Right resize shrink width 10 px or 10 ppt
bindsym $mod+Ctrl+Shift+Up resize grow height 10 px or 10 ppt
bindsym $mod+Ctrl+Shift+Down resize shrink height 10 px or 10 ppt
bindsym $mod+Ctrl+Shift+Left resize grow width 10 px or 10 ppt

As @Oposum said : Save it and restart i3 ($mod+Shift+R).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.