i3wm的基本配置

安装软件

1
2
3
4
5
6
7
8
# 安装额外的软件
apt install i3-wm conky-cli rxvt-unicode xinit feh locales
apt install chromium chromium-l10n pcmanfm gedit fcitx-rime
apt install wireless-tools wpasupplicant bluez bluez-tools
apt install network-manager-gnome alsa-utils volumeicon-alsa
apt install fonts-wqy-zenhei fonts-fork-awesome

# 网上下载Monaco字体后复制到/usr/share/fonts/truetype/i3/Monaco.ttf

I3WM的配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# ~/.config/i3/config
set $mod Mod1
font pango:Monaco 10
floating_modifier $mod

bindcode $mod+36 exec i3-sensible-terminal
bindcode $mod+Shift+24 kill
bindcode $mod+40 exec dmenu_run

bindcode $mod+44 focus left
bindcode $mod+45 focus down
bindcode $mod+46 focus up
bindcode $mod+47 focus right
bindcode $mod+113 focus left
bindcode $mod+116 focus down
bindcode $mod+111 focus up
bindcode $mod+114 focus right

bindcode $mod+Shift+44 move left
bindcode $mod+Shift+45 move down
bindcode $mod+Shift+46 move up
bindcode $mod+Shift+47 move right
bindcode $mod+Shift+113 move left
bindcode $mod+Shift+116 move down
bindcode $mod+Shift+111 move up
bindcode $mod+Shift+114 move right

bindcode $mod+43 split h
bindcode $mod+55 split v
bindcode $mod+41 fullscreen toggle
bindcode $mod+39 layout stacking
bindcode $mod+25 layout tabbed
bindcode $mod+26 layout toggle split
bindcode $mod+Shift+65 floating toggle

bindcode $mod+65 focus mode_toggle
bindcode $mod+38 focus parent

set $ws1 "1"
set $ws2 "2"
set $ws3 "3"
set $ws4 "4"
set $ws5 "5"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
set $ws10 "10"

bindcode $mod+10 workspace $ws1
bindcode $mod+11 workspace $ws2
bindcode $mod+12 workspace $ws3
bindcode $mod+13 workspace $ws4
bindcode $mod+14 workspace $ws5
bindcode $mod+15 workspace $ws6
bindcode $mod+16 workspace $ws7
bindcode $mod+17 workspace $ws8
bindcode $mod+18 workspace $ws9
bindcode $mod+19 workspace $ws10

bindcode $mod+Shift+10 move container to workspace $ws1
bindcode $mod+Shift+11 move container to workspace $ws2
bindcode $mod+Shift+12 move container to workspace $ws3
bindcode $mod+Shift+13 move container to workspace $ws4
bindcode $mod+Shift+14 move container to workspace $ws5
bindcode $mod+Shift+15 move container to workspace $ws6
bindcode $mod+Shift+16 move container to workspace $ws7
bindcode $mod+Shift+17 move container to workspace $ws8
bindcode $mod+Shift+18 move container to workspace $ws9
bindcode $mod+Shift+19 move container to workspace $ws10

bindcode $mod+Shift+54 reload
bindcode $mod+Shift+27 restart
bindcode $mod+Shift+26 exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"

bindcode $mod+27 mode "resize"
mode "resize" {
bindcode 44 resize shrink width 10 px or 10 ppt
bindcode 45 resize grow height 10 px or 10 ppt
bindcode 46 resize shrink height 10 px or 10 ppt
bindcode 47 resize grow width 10 px or 10 ppt
bindcode 113 resize shrink width 10 px or 10 ppt
bindcode 116 resize grow height 10 px or 10 ppt
bindcode 111 resize shrink height 10 px or 10 ppt
bindcode 114 resize grow width 10 px or 10 ppt
bindcode 36 mode "default"
bindcode 9 mode "default"
bindcode $mod+27 mode "default"
}

bar {
status_command conky -c /etc/i3/conkyrc
position top
colors {
background #333333
statusline #FFFFFF
focused_workspace #FFFFFF #FFFFFF #000000
active_workspace #FFFFFF #FFFFFF #FFFFFF
inactive_workspace #333333 #333333 #FFFFFF
urgent_workspace #990000 #990000 #FFFFFF
}
}

default_border pixel 5
bindsym $mod+b exec pcmanfm
bindsym $mod+c exec chromium

exec --no-startup-id feh --bg-scale /etc/i3/buster.png
exec volumeicon
exec nm-applet
exec xrdb /etc/i3/Xresources

CONKY的配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# /etc/i3/conkyrc
conky.config = {

out_to_x = false,
out_to_console = true,
background = false,
double_buffer = false,
update_interval = 1,
total_run_times = 0,
override_utf8_locale = false,
short_units = true,
if_up_strictness = 'address',
cpu_avg_samples = 2
}

conky.text = [[
DN: ${downspeed wlp1s0}/s \
UP: ${upspeed wlp1s0}/s \
CPU: ${cpu cpu0}% \
MEM: ${mem} \
BAT: ${battery_percent}% \
TIME: ${time %H:%M}
]]

URXVT的透明配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# /etc/i3/Xresources
!!URxvt.preeditType:Root
!!设置输入法
!!URxvt.inputMethod:fcitx

!!设置透明
URxvt*background: rgba:0000/0000/0200/c800

!!颜色设置
URxvt*depth: 32
URxvt.inheritPixmap:true
URxvt.foreground:#ffffff
URxvt.colorBD:Gray95
URxvt.colorUL:Green
URxvt.color1:Red2
URxvt.color4:RoyalBlue
URxvt.color5:Magenta2
URxvt.color8:Gray50
URxvt.color10:Green2
URxvt.color12:DodgerBlue
URxvt.color14:Cyan2
URxvt.color15:Gray95

!!URL操作
URxvt.urlLauncher:chromium
URxvt.matcher.button:1
Urxvt.perl-ext-common:matcher

!!滚动条设置
URxvt.scrollBar:False
URxvt.scrollBar_floating:False
URxvt.scrollstyle:plain

!!滚屏设置
URxvt.mouseWheelScrollPage:True
URxvt.scrollTtyOutput:False
URxvt.scrollWithBuffer:True
URxvt.scrollTtyKeypress:True

!!光标闪烁
URxvt.cursorBlink:True
URxvt.saveLines:1000

!!边框
URxvt.borderLess:False

!!字体设置
Xft.dpi:96
URxvt.font:xft:Monaco:antialias=True:pixelsize=15,xft:Monaco:pixelsize=15
URxvt.boldfont:xft:Monaco:antialias=True:pixelsize=18,xft:Monaco:pixelsize=18

登录自启中文桌面环境

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 如果使用Bash,编辑 ~/.profile。如果使用 Zsh,编辑 ~/.zprofile。添加以下内容
# locales添加 zh_CN.UTF-8 后区域设置为 None
# 在locales中系统默认的区域设置别选 zh_CN.UTF-8,它会导致字符界面出现乱码
sudo dpkg-reconfigure locales

cat << EOF >> ~/.profile
export LANG=zh_CN.UTF-8
if [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
exec startx
fi
EOF

# 添加如下到~/.config/i3/config中来设置桌面壁纸
exec --no-startup-id feh --bg-scale /etc/i3/buster.png

配置中州韵中文输入法

1
2
3
4
5
im-config		# 配置默认输入架构,选中Fcitx后重启电脑
fcitx-configtool # 输入法中点+ -> 中州韻

# 按F4选择输入方案,建议明月拼音简化字,将会保存到~/.config/fcitx/rime/user.yaml
# 九个候选字:修改/usr/share/rime-data/default.yaml中的:page_size: 9

网络和音量的托盘图标

1
2
3
# 添加下面内容到~/.config/i3/config
exec nm-applet
exec volumeicon