在 i3 中调整窗口大小(无调整大小模式)

Opo*_*sum 26 keyboard-shortcuts i3

我正在尝试设置我的计算机(运行 Crunchbang Linux Waldorf 和 i3),以便在默认情况下始终配置为按Ctrl+Shift和箭头键根据箭头方向调整窗口大小。

i3的用户指南提供了这个例子,我认为是非常接近我想要的东西:

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"
Run Code Online (Sandbox Code Playgroud)

但我想在本地构建它,而不必进入和退出调整大小模式。我只想箭头键,不使用JKL;键。

关于我将如何做到这一点的任何想法?

Opo*_*sum 19

我自己想出的最佳解决方案:

转到~/.i3/config并打开文件。

在最后粘贴以下代码:

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
Run Code Online (Sandbox Code Playgroud)

保存并运行i3-msg reload

  • `i3-msg reload` 就足够了 (2认同)

小智 6

基于@Oposum 的解决方案,我添加了一个“快速调整大小”:

# 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
Run Code Online (Sandbox Code Playgroud)

所以在我的~/.i3/config我有:

# 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
Run Code Online (Sandbox Code Playgroud)

正如@Oposum 所说:保存并重新启动 i3 ($mod+Shift+R)。