仅使用键盘在i3中调整窗口大小


20

我试图设置计算机(运行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"

但是我想在本地构建它,而不必进入和退出调整大小模式。我只想使用箭头键,而不是j,k,l和分号键。

关于我将如何做的任何想法?

Answers:


13

我弄清楚自己的最佳解决方案:

转到~/.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

保存并重新启动i3。


4

基于@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

所以~/.i3/config我有:

# Resizing windows in i3 using keyboard only
# /unix//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

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


1
您在那里有相同的绑定。
cprn'2

1
@cprn对!已修正
aloisdg说要恢复莫妮卡的状态
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.