一篇关于配置i3wm以及polybar的教程。
本教程的配置后效果图:
建议可以先阅读一些Linux图形界面 相关的知识作为背景,本教程提到的所有文件可以在此仓库 下载。
为什么要使用窗口管理器(WM)而不是桌面环境(DE) 优点:
比之 DE,WM 需要较少的系统资源(内存, cpu, 硬盘空间…)。
WM 在各个方面都有更高的配置自由度。
WM 的配置容易备份和还原
缺点:
默认情况下 WM 比 DE 丑很多。
对于新手来说,WM 的配置比较繁琐。
配置 i3-wm 下载 请务必下载 i3-gaps
而不是 i3-wm
以免部分包冲突。
基本设置 当下载完 i3-wm 后,从登录管理器选择环境为 i3。第一次登录(没检测到修改过的 i3 配置文件)时,会有一个弹出窗口进行非常基本的配置。
默认的配置文件夹路径是 ~/.config/i3/
。
与 i3 本体 相关的配置应放在 ~/.config/i3/config
文件里。
在窗口管理器的环境下,绝大部分的操作可以通过键盘完成,为了避免与其他软件提供的快件键冲突,需要配置一个前导键(Leader Key)。
1 2 3 4 set $mod Mod4 set $m_alt Mod1
整体外观 i3 的外观配置的具体含义可以通过尝试/查询得到,个人认为这部份配置不是特别重要。
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 new_window none new_float normal hide_edge_borders both #隐藏窗口边缘 set $bg #282828 set $red #cc241d set $green #98971a set $yellow #d79921 set $blue #458588 set $purple #b16286 set $aqua #689d68 set $gray #a89984 set $darkgray #1d2021 set $white #ffffff client.focused #4c7899 #285577 #ffffff #2e9ef4 #285577 client.focused_inactive #81c2d6 #5f676a #ffffff #484e50 #0b6e48 client.unfocused #c9cabb #222222 #888888 #292d2e #222222 client.urgent #2f343a #900000 #ffffff #199475 #900000 client.placeholder #a2b4ba #0c0c0c #ffffff #1793d0 #0c0c0c client.background #82abba for_window [window_role="pop-up"] floating enable for_window [window_role="task_dialog"] floating enable for_window [class="Gpicview"] floating enable for_window [class="mpv"] floating enable for_window [class="Gimp"] floating enable for_window [class="Xarchiver"] floating enable for_window [class="Genymotion"] floating enable for_window [class="Vlc"] floating enable for_window [class="VirtualBox"] floating enable for_window [class="Thunar"] floating enable for_window [class="Catfish"] floating enable font pango:Sarasa Mono SC Nerd 10
自启动应用 这里都是登录后的自启动应用
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 exec --no-startup-id xcompmgr exec --no-startup-id compton -b exec --no-startup-id mate-power-manager exec --no-startup-id nm-applet exec --no-startup-id blueman exec --no-startup-id blueman-applet exec --no-startup-id /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 & exec --no-startup-id emacs --daemon exec --no-startup-id i3-msg 'workspace 1; exec --no-startup-id sakura'
键盘快捷键 个人认为 i3 最棒的部分,可以完全定义一套自己习惯的操作快捷键
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 bindsym $mod+d exec --no-startup-id dmenu_run bindsym $m_alt+space exec --no-startup-id rofi -show drun -theme ctheme bindsym $mod+Return exec --no-startup-id sakura bindsym $mod+z exec --no-startup-id sakura bindsym $mod+c exec --no-startup-id firefox bindsym $mod+Shift+c exec --no-startup-id chromium --save-page-as-mhtml bindsym $mod+e exec --no-startup-id thunar bindsym Print exec --no-startup-id "scrot -u -q 100 './Pictures/Screenshots/%Y%m%d_%H%M%s_$wx$h.png'" bindsym --release Shift+Print exec --no-startup-id "scrot -bs -q 100 './Pictures/Screenshots/%Y%m%d_%H%M%s_$wx$h.png'" bindsym --release Control+Print exec --no-startup-id "scrot -s -q 100 './Pictures/Screenshots/%Y%m%d_%H%M%s_$wx$h.png'" bindsym $mod+Shift+e exec --no-startup-id emacsclient -c bindsym $mod+q exec --no-startup-id code bindsym $mod+m exec --no-startup-id xmind bindsym $mod+Shift+z exec --no-startup-id zotero
工作区设置 工作区的定义可以在这里 找。
工作区 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 assign [class="sakura"] 1 assign [class="code"] 2 assign [class="Firefox"] 3 bindsym $mod+Tab workspace next bindsym $m_alt+Tab workspace prev 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 bindsym $mod+1 workspace number $ws1 bindsym $mod+2 workspace number $ws2 bindsym $mod+3 workspace number $ws3 bindsym $mod+4 workspace number $ws4 bindsym $mod+5 workspace number $ws5 bindsym $mod+6 workspace number $ws6 bindsym $mod+7 workspace number $ws7 bindsym $mod+8 workspace number $ws8 bindsym $mod+9 workspace number $ws9 bindsym $mod+0 workspace number $ws10 bindsym $mod+Shift+1 move container to workspace number $ws1 bindsym $mod+Shift+2 move container to workspace number $ws2 bindsym $mod+Shift+3 move container to workspace number $ws3 bindsym $mod+Shift+4 move container to workspace number $ws4 bindsym $mod+Shift+5 move container to workspace number $ws5 bindsym $mod+Shift+6 move container to workspace number $ws6 bindsym $mod+Shift+7 move container to workspace number $ws7 bindsym $mod+Shift+8 move container to workspace number $ws8 bindsym $mod+Shift+9 move container to workspace number $ws9 bindsym $mod+Shift+0 move container to workspace number $ws10
焦点控制 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 bindsym $mod+Left focus left bindsym $mod+Down focus down bindsym $mod+Up focus up bindsym $mod+Right focus right bindsym $mod+u focus parent bindsym $mod+Shift+u focus child focus_follows_mouse yes
窗口控制 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 floating_modifier $mod bindsym $mod+Shift+Left move left bindsym $mod+Shift+Down move down bindsym $mod+Shift+Up move up bindsym $mod+Shift+Right move right bindsym $mod+h split h bindsym $mod+v split v bindsym $mod+space floating toggle bindsym $mod+Shift+space sticky toggle bindsym $mod+f fullscreen toggle bindsym $mod+s layout stacking bindsym $mod+t layout tabbed bindsym $mod+a layout toggle split bindsym $mod+Shift+q kill bindsym $mod+Escape kill bindsym $mod+minus move scratchpad bindsym $mod+plus scratchpad show bindsym $mod+b border toggle
控制窗口大小 i3默认不能直接用鼠标改变窗口大小,需要进入到缩放状态下操作
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 bindsym $mod+Shift+r mode "resize" mode "resize" { bindsym h resize shrink width 10 px or 10 ppt bindsym j resize grow width 10 px or 10 ppt bindsym l resize shrink height 10 px or 10 ppt bindsym k resize grow height 10 px or 10 ppt bindsym Left resize shrink width 10 px or 10 ppt bindsym Right resize grow width 10 px or 10 ppt bindsym Up resize shrink height 10 px or 10 ppt bindsym Down resize grow height 10 px or 10 ppt bindsym Shift+Left resize shrink width 5 px or 5 ppt bindsym Shift+Right resize grow width 5 px or 5 ppt bindsym Shift+Up resize shrink height 5 px or 5 ppt bindsym Shift+Down resize grow height 5 px or 5 ppt bindsym Ctrl+Left resize shrink width 1 px or 1 ppt bindsym Ctrl+Right resize grow width 1 px or 1 ppt bindsym Ctrl+Up resize shrink height 1 px or 1 ppt bindsym Ctrl+Down resize grow height 1 px or 1 ppt bindsym Return mode "default" bindsym Escape mode "default" }
多屏幕相关设置 如果没有同时使用多屏的需求,可直接跳过本节
在开始配置本节之前,需要先正确的安装好显示适配器的驱动,否则可能会有难以解决的问题发生
可以通过一些软件如 arandr
在 GUI 下对屏幕布局进行调整,最终目的是为了获得一条 xrandr 命令。
获得命令后,可以在任意路径下(i3路径下最好)建立一个名为 screen.sh
的脚本,将得到的命令复制进去,而后在 i3 的配置文件中添加以下的这条命令。
1 2 3 exec --no-startup-id bash ~/.config/i3/screen.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 #!/bin/bash f=$(xrandr | grep -c 'HDMI-0 connected' ) if [ $f = "1" ]then xrandr --output DP-0 --primary --mode 3840x2160 --pos 0x0 --rotate normal \--output HDMI-0 --mode 1920x1080 --pos 3840x120 --rotate right \ --output DP-2 --mode 1920x1080 --pos 4920x487 --rotate normal \ --output DP-1 --off \ --output DP-3 --off \ --output DP-4 --off fi
这个脚本通过检测是否插入了多屏设备(如 HDMI-0
)来控制是否进行多屏操作。如果有三个及以上的屏幕,只需要判断启动一个就好,也可以手动添加 case 以适配多种应用情况。
如果想要将一些工作区默认固定在一些屏幕下,可以通过以下命令调整,屏幕(其实是显卡输出口)的名字可以通过 xrandr
命令获得
1 2 3 4 workspace 1 output DP-0 workspace 2 output DP-0 workspace 9 output HDMI-0 workspace 10 output DP-2
操作系统控制 音量、电源、息屏时间与快捷键控制
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 set $refresh_i3status killall -SIGUSR1 i3status bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5% && $refresh_i3status bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5% && $refresh_i3status bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status set $mode_system select: 锁屏(L) 退出用户(E) 重启(R) 关机(O) 取消(Esc) bindsym $mod+$m_alt+Escape mode "$mode_system" mode "$mode_system" { bindsym l mode "default" exec --no-startup-id betterlockscreen -l blur bindsym e exec --no-startup-id i3-msg exit, mode "default" bindsym r exec --no-startup-id systemctl reboot, mode "default" bindsym o exec --no-startup-id systemctl poweroff, mode "default" bindsym Escape mode "default" } exec --no-startup-id xset dpms 1200 1200 exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork
壁纸、锁屏和会话控制 壁纸 这里使用 feh
来控制壁纸,同时这个软件只支持位图形式的图片,不支持矢量图形式的。这里使用的 Debian 系统自带的壁纸(初始为 .svg 文件,通过 inkscape
将其转为 .png)
1 2 inkscape --export-type=png /usr/share/wallpapers/FuturePrototype/contents/images/3840x2160.svg /usr/share/wallpapers/FuturePrototype/contents/images/3840x2160.png feh --no-fehbg --bg-fill '/usr/share/wallpapers/FuturePrototypeWithLogo/contents/images/3840x2160.png'
本文未考虑动态壁纸。
会话 1 2 3 4 5 6 7 8 9 10 11 12 bindsym $mod+$m_alt+c reload bindsym $mod+$m_alt+r restart bindsym $mod+$m_alt+e 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'" bindsym $mod+$m_alt+l mode "i3lock: Return to lock/Escape to Cancel"
锁屏 i3 支持多种锁屏软件,本文使用 betterlockscreen
,同时直接把桌面作为锁屏图片。
1 2 3 4 5 6 7 8 9 10 betterlockscreen -u '/usr/share/wallpapers/FuturePrototypeWithLogo/contents/images/3840x2160.png' mode "i3lock: Return to lock/Escape to Cancel" { bindsym Return mode "default" exec --no-startup-id betterlockscreen -l blur bindsym Escape mode "default" }
状态栏设置 i3 支持多种状态栏,比如 i3status,i3blocks 或者 polybar。每个状态栏有很多内置组件,也可以自制然后在状态栏的配置文件中调用。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 exec --no-startup-id bash ~/.config/i3/polybar/launch.sh
本文现在使用 polybar 作为状态栏,但也附了一份 i3blocks 的可行配置。
polybar 此脚本用于在所有显示器(如果有)上启用 polybar,也可以通过改写脚本实现在固定的显示器输出。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 #!/usr/bin/env bash killall -q polybar while pgrep -u $UID -x polybar > /dev/null; do sleep 1; done if type "xrandr" > /dev/null; then for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do MONITOR=$m polybar --reload mybar -c ~/.config/i3/polybar/config & done else polybar --reload mybar -c ~/.config/i3/polybar/config & fi echo "polybars 已(重新)启动..."
Polybar 有一套自己的配置文件,同时其相关组件的配置要与系统内其他配置符合,如 mpd 的地址和端口号,还有不同网卡的名称等。
如果想要在 polybar 的工作区标题附近显示 符号,请运行以下脚本。
1 2 3 4 5 6 #!/bin/bash counter=0 i3-msg -t get_workspaces | tr ',' '\n' | sed -nr 's/"name":"([^"]+)"/\1/p' | while read -r name; do printf 'ws-icon-%i = "%s;<insert-icon-here>"\n' $((counter++)) $name done
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 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 [colors] background = #77222222 background-alt = #444 foreground = #dfdfdf foreground-alt = #555 primary = #ffb52a secondary = #e60053 alert = #bd2c40 [bar/mybar] monitor = ${env:MONITOR} width = 100% height = 35 radius = 7% fixed-center = false bottom = true background = ${colors.background} foreground = ${colors.foreground} line-size = 5% line-color = #f00 border-size = 0.2% border-color = #00000000 padding-left = 0 padding-right = 1 module-margin-left = 0 module-margin-right = 1% font-0 = Sarasa Mono SC Nerd:size=14:antialias=true;1 modules-left = bspwm i3 modules-center = mpd modules-right = filesystem memory cpu wlan eth battery temperature pulseaudio date tray-position = right tray-padding = 1 cursor-click = pointer cursor-scroll = ns-resize [module/xwindow] type = internal/xwindow label = %title:0:30:...% [module/xkeyboard] type = internal/xkeyboard blacklist-0 = num lock format-prefix = " " format-prefix-foreground = ${colors.foreground-alt} format-prefix-underline = ${colors.secondary} label-layout = %layout% label-layout-underline = ${colors.secondary} label-indicator-padding = 2 label-indicator-margin = 1 label-indicator-background = ${colors.secondary} label-indicator-underline = ${colors.secondary} [module/filesystem] type = internal/fs interval = 25 mount-0 = / mount-1 = /home mount-2 = /data label-mounted = %mountpoint%%{F-}:%percentage_used%% label-unmounted = %mountpoint% umnt label-unmounted-foreground = #ebebeb format-mounted-underline = #ebebeb format-unmounted-underline = #ebebeb [module/bspwm] type = internal/bspwm label-focused = %index% label-focused-background = ${colors.background-alt} label-focused-underline= ${colors.primary} label-focused-padding = 2 label-occupied = %index% label-occupied-padding = 2 label-urgent = %index%! label-urgent-background = ${colors.alert} label-urgent-padding = 2 label-empty = %index% label-empty-foreground = ${colors.foreground-alt} label-empty-padding = 2 [module/i3] type = internal/i3 format = <label-state> <label-mode> index-sort = true wrapping-scroll = false ws-icon-0 = 1 ws-icon-1 = 2 ws-icon-2 = 3 ws-icon-3 = 4 ws-icon-4 = 5 ws-icon-5 = 6 ws-icon-6 = 7 ws-icon-7 = 8 ws-icon-8 = 9 ws-icon-9 = 10 pin-workspaces = true label-mode = %mode% label-mode-padding = 1 label-mode-foreground = #000 label-mode-background = ${colors.primary} label-focused = %index% %icon% label-focused-background = ${colors.background-alt} label-focused-underline= ${colors.primary} label-focused-padding = 2 label-unfocused = %index% %icon% label-unfocused-padding = 2 label-visible = %index% %icon% label-visible-background = ${self.label-focused-background} label-visible-underline = ${self.label-focused-underline} label-visible-padding = ${self.label-focused-padding} label-urgent = %index% label-urgent-background = ${colors.alert} label-urgent-padding = 2 [module/mpd] type = internal/mpd host = 127.0.0.1 port = 7777 format-online = <label-song> <label-time> <icon-prev> <icon-seekb> <icon-stop> <toggle> <icon-seekf> <icon-next> <icon-repeat> <icon-random> format-offline = <label-offline> format-offline-foreground = #66 label-offline = -------- label-song-maxlen = 20 label-song-font = 8 icon-prev = ⇐ icon-seekb = ⇠ icon-stop = icon-play = icon-pause = icon-next = ⇒ icon-seekf = ⇢ icon-random = icon-repeat = toggle-on-foreground = #2278ff toggle-off-foreground = #66 bar-progress-width = 9 bar-progress-indicator = | bar-progress-indicator-foreground = #bb bar-progress-fill = bar-progress-fill-foreground = #bb bar-progress-fill-font = 3 bar-progress-empty = bar-progress-empty-foreground = #44 bar-progress-empty-font = 3 label-time-foreground = #55 [module/xbacklight] type = internal/xbacklight format = <label> <bar> label = BL bar-width = 10 bar-indicator = | bar-indicator-foreground = #fff bar-indicator-font = 2 bar-fill = ─ bar-fill-font = 2 bar-fill-foreground = #9f78e1 bar-empty = ─ bar-empty-font = 2 bar-empty-foreground = ${colors.foreground-alt} [module/backlight-acpi] inherit = module/xbacklight type = internal/backlight card = intel_backlight [module/cpu] type = internal/cpu interval = 2 format-prefix = " " format-prefix-foreground = #f90000 format-underline = #f90000 label = %percentage:2%% [module/memory] type = internal/memory interval = 2 format-prefix = " " format-prefix-foreground = #7CFC00 format-underline = #7CFC00 label = %percentage_used:2%% [module/wlan] type = internal/network interface = wlan0 interval = 3.0 format-connected = <ramp-signal> <label-connected> format-connected-underline = #9f78e1 label-connected = %essid% format-disconnected = ramp-signal-0 = ramp-signal-1 = ramp-signal-2 = ramp-signal-3 = ramp-signal-4 = ramp-signal-foreground = #9f78e1 [module/eth] type = internal/network interface = eth0 interval = 3.0 format-connected-underline = #55aa55 format-connected-prefix = " " format-connected-prefix-foreground = #55aa55 label-connected = %local_ip% format-disconnected = [module/date] type = internal/date interval = 1 date = date-alt = " %Y-%m-%d %A" time = %H:%M time-alt = %H:%M:%S format-prefix = format-prefix-foreground = #0a6cf5 format-underline = #0a6cf5 label = %date% %time% [module/pulseaudio] type = internal/pulseaudio format-volume = <label-volume> format-volume-underline = #4bffdc label-volume = %percentage%% label-volume-foreground = ${root.foreground} label-muted = muted label-muted-foreground = #666 format-muted-underline = #4bffdc bar-volume-width = 5 bar-volume-foreground-0 = #55aa55 bar-volume-foreground-1 = #55aa55 bar-volume-foreground-2 = #55aa55 bar-volume-foreground-3 = #55aa55 bar-volume-foreground-4 = #55aa55 bar-volume-foreground-5 = #f5a70a bar-volume-foreground-6 = #ff5555 bar-volume-gradient = false bar-volume-indicator = | bar-volume-indicator-font = 2 bar-volume-fill = ─ bar-volume-fill-font = 2 bar-volume-empty = ─ bar-volume-empty-font = 2 bar-volume-empty-foreground = ${colors.foreground-alt} [module/alsa] type = internal/alsa format-volume = <label-volume> <bar-volume> label-volume = VOL label-volume-foreground = ${root.foreground} format-muted-prefix = " " label-muted = sound muted bar-volume-width = 10 bar-volume-foreground-0 = #55aa55 bar-volume-foreground-1 = #55aa55 bar-volume-foreground-2 = #55aa55 bar-volume-foreground-3 = #55aa55 bar-volume-foreground-4 = #55aa55 bar-volume-foreground-5 = #f5a70a bar-volume-foreground-6 = #ff5555 bar-volume-gradient = false bar-volume-indicator = | bar-volume-indicator-font = 2 bar-volume-fill = ─ bar-volume-fill-font = 2 bar-volume-empty = ─ bar-volume-empty-font = 2 bar-volume-empty-foreground = ${colors.foreground-alt} [module/battery] type = internal/battery battery = BAT1 adapter = ADP1 full-at = 98 format-charging = <animation-charging> <label-charging> format-charging-underline = #ffb52a format-discharging = <animation-discharging> <label-discharging> format-discharging-underline = ${self.format-charging-underline} format-full-prefix = " " format-full-prefix-foreground = #ffb52a format-full-underline = ${self.format-charging-underline} ramp-capacity-0 = ramp-capacity-1 = ramp-capacity-2 = ramp-capacity-foreground = ${colors.foreground-alt} animation-charging-0 = animation-charging-1 = animation-charging-2 = animation-charging-foreground = #ffb52a animation-charging-framerate = 750 animation-discharging-0 = animation-discharging-1 = animation-discharging-2 = animation-discharging-foreground = #ffb52a animation-discharging-framerate = 750 [module/temperature] type = internal/temperature thermal-zone = 0 warn-temperature = 60 format = <ramp> <label> format-underline = #228B22 format-warn = <ramp> <label-warn> format-warn-underline = ${self.format-underline} label = %temperature-c% label-warn = %temperature-c% label-warn-foreground = ${colors.secondary} ramp-0 = ramp-1 = ramp-2 = ramp-foreground = #228B22 [module/powermenu] type = custom/menu expand-right = true format-spacing = 1 label-open = label-open-foreground = ${colors.secondary} label-close = label-close-foreground = ${colors.secondary} label-separator = | label-separator-foreground = ${colors.foreground-alt} menu-0-0 = reboot menu-0-0-exec = menu-open-1 menu-0-1 = power off menu-0-1-exec = menu-open-2 menu-1-0 = cancel menu-1-0-exec = menu-open-0 menu-1-1 = reboot menu-1-1-exec = sudo reboot menu-2-0 = power off menu-2-0-exec = sudo poweroff menu-2-1 = cancel menu-2-1-exec = menu-open-0 [settings] screenchange-reload = true [global/wm] margin-top = 5 margin-bottom = 5
i3blocks i3blocks 的主配置文件。
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 command =~/.config/i3/i3blocks/$BLOCK_NAME separator_block_width =20 markup =noneseparator =false [bandwidth] instance =eth0interval =5 color=#fabd2f label =separator_block_width =1 [spacer] separator_block_width =1 full_text =|[bandwidth] label =instance =wlan0interval =1 color=#d79921 separator_block_width =1 [spacer] separator_block_width =1 full_text =|[cpu_usage] label =interval =10 min_width =100.00 %color=#fb4934 separator_block_width =1 [spacer] separator_block_width =1 full_text =|[temperature] label =interval =10 color=#fabd2f separator_block_width =1 [spacer] separator_block_width =1 full_text =|[memory] label =interval =20 color=#b8bb26 separator_block_width =1 [spacer] separator_block_width =1 full_text =|[volume_pactl] label =interval =1 color=#fb4934 separator_block_width =1 [spacer] separator_block_width =1 full_text =|[disk_usage] label =instance =/interval =20 color=#fabd2f separator_block_width =5 [disk_usage] instance =/homeinterval =20 color=#fabd2f separator_block_width =1 [spacer] separator_block_width =1 full_text =|[battery] label =instance =1 interval =20 color=#b8bb26 separator_block_width =1 [spacer] separator_block_width =1 full_text =|[date] command =date "+%a %Y-%m-%d %H:%M:%S" interval =1 color=#fabd2f