我的环境

为什么选择manjaro i3

它并不是官方出的一个发行版,而是一个社区版,我为什么选择它呢?因为manjaro本身是基于arch,但是比arch更稳定的发行版,它的功能更加齐全,不需要像arch一样,很多东西都要自己来适配。它的兼容性比arch又好了许多,可以自己选择驱动、内核。manjaro i3附带了已经配置好了的i3,直接开箱即用,即便还是很丑,可以省去大把时间。

i3配置

虽然manjaro i3 已经是配置好了的,但是还是不是很美观,毕竟众口难调嘛,所以作者只是简单的修了一下边福。

配置文件

  • 位置:~/.i3/config

打开它如果,如果你习惯它的快捷键配置就不要用去改它的快捷键了,直接用更好的一些工具去替换它的一些工具。下面我们就去修改他默认的工具。

polybar

  • 默认:i3status
  • 替换:polybar

比i3tatus强大,而且更好看

安装polybar

sudo pacman -S polybar

使用polybar

需要在~/.config/polybar文件夹里面建立一个launch.sh脚本文件。

1
2
3
4
5
6
7
8
9
10
11
# Basic script to kill all old bars and launch new.

# Terminate already running bad instances
killall -q polybar

# Wait until the processes have been shut down
# while grep -x polybar >/dev/null; do sleep 1; done
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done

# Launch the example bar
polybar main_bar

  • 修改i3配置文件 ~/.i3/config

删除i3配置文件的这些部分

1
2
3
bar {
#code...
}

添加为

1
exec_always --no-startup-id $HOME/.config/polybar/launch.sh

win+shift+r重启i3,不出意外,你就能看见了。如果没有显示,不要慌,接着看。

polybar不显示

如果遇到polybar不显示,打开终端输入如下命令

polybar -m

这条命令会输出你显示屏的通信接口类型,类似eDP1这样的。替换polybar配置文件中的如下部分

1
monitor = ${env:MONITOR:eDP1} //eDP1为终端输出的部分

然后重启i3你就能看见polybar了。

美化

你可以去网上找各种配置,都很好看的,不嫌弃的话也可以使用我的。

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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;; Fonts you may want if changing the font ;;;;;;;;
;;;;;;;; --- ttf-font-awesome ;;;;;;;;
;;;;;;;; --- ttf-material-icons ;;;;;;;;
;;;;;;;; --- nerd-fonts-complete ;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;; Colours
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


[colors]
background = #1010100
foreground = #EFF0F1
urgent = #E64141
blue = #1793D1
b-alt = #00131313
green = #037713
g-alt = #087717




;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;; Bars
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

[settings]
throttle-output = 5
throttle-output-for = 10
throttle-input-for = 30
compositing-background = over
compositing-foreground = over
compositing-overline = over
compositing-underline = over
compositing-border = over
screenchange-reload = true

[global/wm]
; Adjust the _NET_WM_STRUT_PARTIAL top value
; Used for top aligned bars
margin-top = 5
margin-bottom = 5

[bar/main_bar]
; Use xrandr -q | grep " connected" | cut -d ' ' -f1
; for a list of connected monitors
monitor = ${env:MONITOR:eDP1}
monitor-strict = false
override-redirect = false
width = 100%
height = 20
fixed-center = true
background = ${colors.background}
foreground = ${colors.foreground}

font-0 = Ubuntu Nerd Font:size=11;2
;font-1 = FontAwesome:pixelsize=12;2
;font-2 = MaterialIcons:size=12;2
;font-3 = Fira Sans:size=10:weight=thin;2

modules-left = menu workspaces
modules-center = weather xtitle filesystem temp cpu memory trash
modules-right = data battery

module-margin = 0
padding-right = 0
padding-left = 0
bottom = false
underline-size = 2

tray-position = right
tray-padding = 9
tray-transparent = false
tray-offset-y = 0%
tray-offset-x = 0%
tray-maxsize = 18
tray-detached = false
tray-background = ${colors.background}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;; Modules
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



[module/data]
type = internal/date
format = <label>
label-padding-right = 0
format-background = ${colors.b-alt}

interval = 2
time = %R
label = %{A1:gsimplecal & disown:} %{A3:gsimplecal & disown:} %time% %{A}%{A}
label-padding = 3


; Openbox specific

[module/menu]
type = custom/menu
format-spacing = 1
format-background = ${colors.b-alt}
label-open = "  "
label-open-foreground = ${colors.foreground}
label-open-background = ${colors.b-alt}
label-close = "  "
label-close-foreground = ${colors.urgent}
label-separator = " | "
label-separator-foreground = ${colors.foreground}
# Top level
menu-0-0 = "  "
menu-0-0-exec = menu-open-1
menu-0-1 = "  |"
menu-0-1-exec = menu-open-2
# 1
menu-1-0 = "  "
menu-1-0-exec = exo-open --launch WebBrowser
menu-1-1 = "  "
menu-1-1-exec = i3-scrot -s
menu-1-2 = "  |"
menu-1-2-exec = exo-open --launch FileManager
# 3
menu-2-0 = "  "
menu-2-0-exec = menu-open-0
menu-2-1 = "  "
menu-2-1-exec = blurlock
menu-2-2 = "  "
menu-2-2-exec = i3exit logout
menu-2-3 = "  "
menu-2-3-exec = systemctl reboot
menu-2-4 = "  |"
menu-2-4-exec = systemctl poweroff


[module/workspaces]
type = internal/xworkspaces
enable-click = true
enable-scroll = true
format-padding = 0
Additional formatting
icon-0 = 1;
icon-1 = 2;
icon-2 = 3;
icon-3 = 4;
icon-4 = 5;
icon-5 = 6;
icon-6 = 7;
icon-7 = 8;
icon-8 = 9;
icon-9 = 10;
icon-10 =
;icon-default = 

format = <label-state>

label-active = " %icon% "
label-active-foreground = ${colors.g-alt}
label-active-background = ${colors.b-alt}
label-active-underline = ${colors.g-alt}

label-occupied = " %icon% "
label-occupied-underline = ${colors.blue}
label-occupied-background = ${colors.b-alt}
label-occupied-foreground = ${colors.foreground}

label-urgent = " %icon% "
label-urgent-foreground = ${colors.urgent}
label-urgent-background = ${colors.b-alt}
label-urgent-underline = ${colors.urgent}

label-empty = " %icon% "
label-empty-foreground = ${colors.foreground}
label-empty-background = ${colors.b-alt}






; Extra modules



[module/battery]
type = internal/battery
full-at = 98

; Use the following command to list batteries and adapters:
; $ ls -1 /sys/class/power_supply/
battery = BAT0
adapter = ACAD

poll-interval = 5
time-format = %H:%M
format-charging = <animation-charging><label-charging>
format-discharging = <ramp-capacity>
format-full = <ramp-capacity>
format-padding = 0
label-charging = "  "
label-charging-background = ${colors.b-alt}
label-discharging-background = ${colors.b-alt}
format-charging-background = ${colors.b-alt}
format-discharging-background = ${colors.b-alt}
format-full-background = ${colors.b-alt}
ramp-capacity-0 = "  "
ramp-capacity-1 = "  "
ramp-capacity-2 = "  "
ramp-capacity-3 = "  "
ramp-capacity-4 = "  "
ramp-capacity-background = ${colors.b-alt}
bar-capacity-width = 10
animation-charging-0 = " "
animation-charging-1 = " "
animation-charging-2 = " "
animation-charging-3 = " "
animation-charging-4 = " "
animation-charging-framerate = 750
animation-charging-background = ${colors.b-alt}



[module/trash]
label-foreground = ${colors.green}
label-background = ${colors.b-alt}
interval = 3
type = custom/script
exec = $HOME/.config/polybar/scripts/trash
format-prefix = "  "
format-prefix-foreground = ${colors.green}
format-prefix-background = ${colors.b-alt}
format-background = ${colors.b-alt}
click-right = rm -rf $HOME/.local/share/Trash/files/*
click-left = exo-open --launch FileManager $HOME/.local/share/Trash/files


[module/filesystem]
type = internal/fs
interval = 25
mount-0 = /
label-mounted = |<  %percentage_used%%
label-padding-left = 5
label-mounted-foreground = ${colors.foreground}
label-mounted-background = ${colors.b-alt}
label-unmounted = %mountpoint% not mounted
label-unmounted-foreground = ${colors.blue}
label-unmounted-background = ${colors.b-alt}
label-padding = 2


[module/rofi]
type = custom/script
exec = echo "  "
click-left = rofi-apps
label-foreground = ${colors.foreground}
label-background = ${colors.b-alt}


[module/temp]
type = internal/temperature
interval = 3
thermal-zone = 0
warn-temp = 70
format = <label>
format-padding = 2
label-foreground = ${colors.foreground}
label-background = ${colors.b-alt}
label-warn-foreground = ${colors.urgent}
label = " %temperature% "
label-warn = " %temperature% "


[module/memory]
type = internal/memory
interval = 3
format = <label>
format-padding = 2
format-prefix = " "
format-prefix-foreground = ${colors.foreground}
format-prefix-background = ${colors.b-alt}
label = %{A1:termite --geometry=750x550 --exec=htop & disown:}%percentage_used%%%{A}
label-foreground = ${colors.foreground}
label-background = ${colors.b-alt}


[module/cpu]
type = internal/cpu
interval = 3
format-padding = 2
format-prefix = " "
format-prefix-foreground = ${colors.foreground}
format-prefix-background = ${colors.b-alt}
label = %{A1:termite --geometry=750x550 --exec=htop & disown:}%percentage%%%{A}
label-background = ${colors.b-alt}

[module/weather]
type = custom/script
interval = 10
format = <label>
label-padding-right = 2
format-prefix = " "
format-prefix-foreground = ${colors.foreground}
exec = ~/.config/polybar/scripts/weather.sh

label-background = ${colors.b-alt}

[module/xtitle]
type = internal/xwindow
interval = 1
label = %title%
label-maxlen = 40 label = %{A1:skippy-xd --toggle-window-picker:}
exec = echo "$(xtitle)"
format = <label>
format-backround = #ooffffff
format-prefix = " >|  "
format-prefix-foreground = ${colors.foreground}
format-padding = 1

复制后,你可能无法使用,文章开头我的配置进入我的GIthub 下载

Rofi

  • 默认:dmenu
  • 替换:rofi

rofi比dmenu更好用,更快捷,更方便,更美观

安装Rofi

sudo pacman -S rofi

使用Rofi

这个比较简单,直接在i3配置文件里面修改

  • 原文件为

    1
    2
    # start program launcher
    bindsym $mod+d exec --no-startup-id dmenu_recency
  • 修改为

    1
    2
    3
    4
    # start drofi dmenu
    bindsym $mod+Tab exec --no-startup-id rofi -show window
    bindsym $mod+Shift+d exec --no-startup-id rofi -show run
    bindsym $mod+d exec --no-startup-id rofi -show drun

美化

/home/angus/.extend.Xresources文件最下方加入如下配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
! ROFI SETUP HERE !

! Enable the extended coloring options
rofi.color-enabled: true
! bg border separator
rofi.color-window: #1E272B, #9D6A47, #9D6A47
! bg fg bg-alt hl-bg hl-fg
rofi.color-normal: #1E272B, #EAD49B, #1E272B, #1E272B, #78824B
rofi.color-active: #1E272B, #EAD49B, #1E272B, #1E272B, #78824B
rofi.color-urgent: #1E272B, #EAD49B, #1E272B, #1E272B, #78824B

rofi.separator-style: solid
rofi.sidebar-mode: false
rofi.lines: 5
rofi.font: Hack Regular 12
rofi.bw: 1
rofi.columns: 2
rofi.padding: 5
rofi.fixed-num-lines: true
rofi.hide-scrollbar: true

重启i3后使用win+d呼出rofi。

晒图

我的桌面

我的桌面