- 前言
- 配置
2.1 配置文件
2.2 配置解释 - 配置 i3bar
1. 前言
在上一篇中,已经说了如何安装和使用 i3,那么在这一篇中,将会说如何配置 i3,让 i3 看起来更舒服一点。
2. 配置
2.1 配置文件
i3 的配置文件所在的位置是 /etc/i3/config
,不过不推荐修改这个,应当先把这个文件复制到 ~/.i3/config
或 ~/.config/i3/config
2.2 配置解释
部分可能在默认配置文件里面没有,有需要就自己写上去。
以 #
开头的行是注释,不用管。
以 font pango:
开头的行是字体设置,用来设置成系统已经装有的字体。
font pango:<family list> [<style options>] <size>
---
font pango:DejaVu Sans Mono 10
---
font pango:DejaVu Sans Mono, Terminus Bold Semi-Condensed 11
---
font pango:Terminus 11px
---推荐设置一个好看的中文字体
font pango:Noto Sans CJK SC 12
---
font pango:WenQuanYi Zen Hei 12
以 bindsym
开头的行是设置快捷键,推荐以$mod
开头,防止和其他软件冲突。
bindsym [--release] [<Group>+][<Modifiers>+]<keysym> command
---
# Fullscreen
bindsym $mod+f fullscreen toggle
# Restart
bindsym $mod+Shift+r restart
# Notebook-specific hotkeys
bindcode 214 exec --no-startup-id /home/michael/toggle_beamer.sh
# Simulate ctrl+v upon pressing $mod+x
bindsym --release $mod+x exec --no-startup-id xdotool key --clearmodifiers ctrl+v
# Take a screenshot upon pressing $mod+x (select an area)
bindsym --release $mod+x exec --no-startup-id import /tmp/latest-screenshot.png
以 bindsym
开头的还能鼠标绑定。
bindsym [--release] [--border] [--whole-window] [<Modifiers>+]button<n> command
---
# The middle button over a titlebar kills the window
bindsym --release button2 kill
# The middle button and a modifer over any part of the window kills the window
bindsym --whole-window $mod+button2 kill
# The right button toggles floating
bindsym button3 floating toggle
bindsym $mod+button3 floating toggle
# The side buttons move the window around
bindsym button9 move left
bindsym button8 move right
以 mode
开头的是组合模块,可以在快捷键之后选择做的事。
# config directive
mode [--pango_markup] <name>
# command
mode <name>
---
# Press $mod+o followed by either f, t, Esc or Return to launch firefox,
# thunderbird or return to the default mode, respectively.
set $mode_launcher Launch: [f]irefox [t]hunderbird
bindsym $mod+o mode "$mode_launcher"
mode "$mode_launcher" {
bindsym f exec firefox
bindsym t exec thunderbird
bindsym Esc mode "default"
bindsym Return mode "default"
}
以 floating_modifier
开头的是浮动模式移动组合键,设置之后可以按下这个键和鼠标进行拖动浮动模式的窗口。
floating_modifier <Modifier>
---
floating_modifier Mod1
以 floating_minimum_size
或 floating_maximum_size
开头的是浮动窗口最小或最大尺寸,设置成 -1
时,不约束,设置成 0
或不设置则使用默认值。
floating_minimum_size <width> x <height>
floating_maximum_size <width> x <height>
---
floating_minimum_size 75 x 50
floating_maximum_size -1 x -1
以 default_orientation
开头的是设置新工作区默认打开方向。
default_orientation horizontal|vertical|auto
---
default_orientation vertical
以 new_window
和 new_float
开头的是设置新窗口的边框样式。
new_window normal|none|pixel
new_window normal|pixel <px>
new_float normal|none|pixel
new_float normal|pixel <px>
---
new_window pixel
---The "normal" and "pixel" border styles support an optional border width in pixels:
# The same as new_window none
new_window pixel 0
# A 3 px border
new_window pixel 3
以 hide_edge_borders
开头的是设置是否隐藏相接的两个窗口之间的边框。
hide_edge_borders none|vertical|horizontal|both
---
hide_edge_borders both
以 set
开头的是设置变量,例如可以设置一堆组合键成一个简单的词。
set $<name> <value>
---
set $m Mod1
bindsym $m+Shift+r restart
以 assign
开头的是设置自动移到工作区。
assign <criteria> [→] [workspace] <workspace>
---
# Assign URxvt terminals to workspace 2
assign [class="URxvt"] 2
# Same thing, but more precise (exact match instead of substring)
assign [class="^URxvt$"] 2
# Same thing, but with a beautiful arrow :)
assign [class="^URxvt$"] → 2
# Assignment to a named workspace
assign [class="^URxvt$"] → work
# Start urxvt -name irssi
assign [class="^URxvt$" instance="^irssi$"] → 3
以 exec
和 exec_always
开头的是设置自动启动程序,exec_always
会在重启 i3 时跟着重启。
exec [--no-startup-id] <command>
exec_always [--no-startup-id] <command>
---
exec chromium
exec_always ~/my_script.sh
# Execute the terminal emulator urxvt, which is not yet startup-notification aware.
exec --no-startup-id urxvt
以 workspace
开头的是设置工作区显示在哪个屏幕的。
workspace <workspace> output <output>
---
workspace 1 output LVDS1
workspace 5 output VGA1
workspace "2: vim" output VGA1
以 client.focused
client.focused_inactive
client.unfocused
client.urgent
client.placeholder
client.background
开头的是设置对应的东西的颜色的。
<colorclass> <border> <background> <text> <indicator> <child_border>
---
# class border backgr. text indicator child_border
client.focused #4c7899 #285577 #ffffff #2e9ef4 #285577
client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a
client.unfocused #333333 #222222 #888888 #292d2e #222222
client.urgent #2f343a #900000 #ffffff #900000 #900000
client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c
client.background #ffffff
以 focus_follows_mouse
开头的是设置焦点是否跟随鼠标。
focus_follows_mouse yes|no
---
focus_follows_mouse no
以 mouse_warping
开头的是设置鼠标是否换位。
mouse_warping output|none
---
mouse_warping none
以 popup_during_fullscreen
开头的是设置全屏模式下遇到弹窗的处理方法。
popup_during_fullscreen smart|ignore|leave_fullscreen
---
popup_during_fullscreen smart
以 workspace_auto_back_and_forth
开头的是设置是否启用回到之前的工作区的。
workspace_auto_back_and_forth yes|no
---
workspace_auto_back_and_forth yes
以 force_display_urgency_hint
开头的是设置是否启用延时焦点复位,能防止不知道那个窗口发送了提示。
force_display_urgency_hint <timeout> ms
---
force_display_urgency_hint 500 ms
想看更多?赶紧关注和打赏我~
3. 配置 i3bar
参考来源
I3 (简体中文) - ArchWiki
i3 - improved tiling wm
本系列文章:
《安装使用配置 i3》——冻皮
《安装使用配置 i3——配置》——冻皮
《安装使用配置 i3——i3bar》——冻皮
本文其他链接:《安装使用配置 i3——配置》——冻皮博客
![](https://img.haomeiwen.com/i3204629/59e02989ec5d6f8d.png)
本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。
你是否看到本文不少链接后面有个方框?不要方,这是因为你没安装 Font Awesome 字体,安装后这个问题就会消失啦~
网友评论