polybar 配置文件
我的polybar配置
- 效果
你可能碰到的问题
- 如果图标不能显示,则需要下载
Font Awesome
字体 - 有些模块无法使用,需要查看自身设备的型号,修改配置文件的相关参数
- 可以去awesome网站上使用喜欢的图标更换现有的awesome官网
- 想要实现图片中的模糊半透明效果需要下载这个大佬改版的picom,然后直接偷其配置文件即可
- 天气模块需要脚本,使用时需要修改模块中的路径
配置文件
[colors]
primary = #F0C674
secondary = #8ABEB7
disabled = #707880
background = #282a36
background-alt = #bd93f9
foreground = #f8f8f2
foreground-alt = #E5E9F0
alert = #ED8082
purple = #bd93f9
orange = #E69875
blue = #7FBBB3
blue-light-rain = #73CEF4
green = #A7C080
green2 = #7C8377
pink = #D196B3
red = #ff5555
gray = #445055
darkgreen = #323C41
fg2 = #939A8F
trans = #00000000
semi-trans-black = #aa000000
[bar/example]
width = 100%
height = 30
radius = 8.0
; dpi = 96
bottom = false
background = ${colors.background}
foreground = ${colors.foreground}
line-size = 3pt
;border-size = 4pt
;border-color = #00000000
padding-left = 0
padding-right = 1
module-margin = 1
border-top-size = 5
border-left-size = 5
border-right-size = 5
border-bottom-size = 0
;separator = |
separator-foreground = ${colors.blue-light-rain}
font-0 = Monaco:size=12;0
font-1 = Font Awesome 6 FreeRegular:size=12;0
font-2 = Font Awesome 6 Brands:size=12;0
font-3 = Font Awesome 6 Free Solid:size=13;0
font-4 = Source Code Pro:size=12;0
modules-left = rofi i3 xwindow
modules-right = memory cpu wlan volume temperature weather battery date
cursor-click = pointer
cursor-scroll = ns-resize
enable-ipc = true
; tray-position = right
; wm-restack = generic
; wm-restack = bspwm
; wm-restack = i3
; override-redirect = true
[module/round-left]
type = custom/text
content = %{T6}%{T-}
;content = %{T6}%{T-}
content-foreground = ${colors.background-alt}
[module/xwindow]
type = internal/xwindow
label = %title:0:60:...%
;label-foreground = #F0FFF0
;label-foreground = #F0F8FF
label-foreground = ${colors.primary}
[module/battery]
type = internal/battery
battery = BAT1
adapter = ADP1
format-charging = <animation-charging> <label-charging>
format-discharging = <ramp-capacity> <label-discharging>
format-full = %{F#666}%{F#ccfafafa} <label-full>
#label-charging-font = 3
#label-discharing-font = 3
label-focused-foreground = #E6E6FA
ramp-capacity-0 =
ramp-capacity-1 =
ramp-capacity-2 =
; low power alert
ramp-capacity-0-foreground = #ff5555
; it will display over the three pattern when charing
; at a framerate 750
; and each has a foreground color
animation-charging-0 =
animation-charging-1 =
animation-charging-2 =
animation-charging-2-foreground = #aaff77
animation-charging-1-foreground = #fba922
animation-charging-0-foreground = #ff5555
animation-charging-framerate = 750
[module/temperature]
type = internal/temperature
thermal-zone = 0
warn-temperature = 60
format = <ramp> <label>
format-warn = <ramp> <label-warn>
format-warn-underline = ${colors.red}
label = %temperature-c%
label-warn = %temperature-c%
label-warn-foreground = ${colors.secondary}
ramp-0 =
ramp-1 =
ramp-2 =
ramp-0-foreground = #87CEFA
ramp-1-foreground = #FF69B4
ramp-2-foreground = #FF0000
ramp-foreground = ${colors.foreground-alt}
[module/volume]
type = internal/alsa
format-volume = <ramp-volume> <label-volume>
format-muted = 0%
ramp-volume-0 =
ramp-volume-1 =
ramp-volume-2 =
ramp-volume-0-foreground = ${colors.blue}
ramp-volume-1-foreground = ${colors.blue}
ramp-volume-2-foreground = ${colors.blue}
[module/filesystem]
type = internal/fs
interval = 25
mount-0 = /
label-mounted = %{F#F0C674}%mountpoint%%{F-} %percentage_used%%
label-unmounted = %mountpoint% not mounted
label-unmounted-foreground = ${colors.disabled}
[module/pulseaudio]
type = internal/pulseaudio
format-volume-prefix = "VOL "
format-volume-prefix-foreground = ${colors.primary}
format-volume = <label-volume>
label-volume = %percentage%%
label-muted = muted
label-muted-foreground = ${colors.disabled}
[module/memory]
type = internal/memory
interval = 2
format-prefix = "RAM "
format-prefix-foreground = ${colors.purple}
format = <label> <ramp-used>
label = %percentage_used:2%%
;label-font = 3
; Only applies if <bar-used> is used
bar-used-indicator =
bar-used-width = 50
bar-used-foreground-0 = #55aa55
bar-used-foreground-1 = #557755
bar-used-foreground-2 = #f5a70a
bar-used-foreground-3 = #ff5555
bar-used-fill = ▐
bar-used-empty = ▐
bar-used-empty-foreground = #444444
; Only applies if <ramp-used> is used
ramp-used-0 = ▁
ramp-used-1 = ▂
ramp-used-2 = ▃
ramp-used-3 = ▄
ramp-used-4 = ▅
ramp-used-5 = ▆
ramp-used-6 = ▇
ramp-used-7 = █
ramp-used-0-foreground = #aaff77
ramp-used-1-foreground = #aaff77
ramp-used-2-foreground = #aaff77
ramp-used-3-foreground = #aaff77
ramp-used-4-foreground = #fba922
ramp-used-5-foreground = #fba922
ramp-used-6-foreground = #ff5555
ramp-used-7-foreground = #ff5555
; Only applies if <ramp-free> is used
ramp-free-0 = ▁
ramp-free-1 = ▂
ramp-free-2 = ▃
ramp-free-3 = ▄
ramp-free-4 = ▅
ramp-free-5 = ▆
ramp-free-6 = ▇
ramp-free-7 = █
[module/cpu]
;type = internal/cpu
;interval = 2
;
;format-prefix = "CPU "
;format-prefix-foreground = ${colors.primary}
;label = %percentage:2%%
type = internal/cpu
; Seconds to sleep between updates
; Default: 1
interval = 3.0
; Available tags:
; <label> (default)
; <bar-load>
; <ramp-load>
; <ramp-coreload>
format = <label> <ramp-load>
; Available tokens:
; %percentage% (default) - total cpu load averaged over all cores
; %percentage-sum% - Cumulative load on all cores
; %percentage-cores% - load percentage for each core
; %percentage-core[1-9]% - load percentage for specific core
format-prefix = "CPU "
format-prefix-foreground = ${colors.purple}
label = %percentage%%
;label-font = 3
; Spacing between individual per-core ramps
ramp-coreload-spacing = 1
ramp-coreload-0 = ▁
ramp-coreload-1 = ▂
ramp-coreload-2 = ▃
ramp-coreload-3 = ▄
ramp-coreload-4 = ▅
ramp-coreload-5 = ▆
ramp-coreload-6 = ▇
ramp-coreload-7 = █
; ramps for ramp-load
ramp-load-0 = ▁
ramp-load-1 = ▂
ramp-load-2 = ▃
ramp-load-3 = ▄
ramp-load-4 = ▅
ramp-load-5 = ▆
ramp-load-6 = ▇
ramp-load-7 = █
; colors for each ramp
ramp-load-0-foreground = #aaff77
ramp-load-1-foreground = #aaff77
ramp-load-2-foreground = #aaff77
ramp-load-3-foreground = #aaff77
ramp-load-4-foreground = #fba922
ramp-load-5-foreground = #fba922
ramp-load-6-foreground = #ff5555
ramp-load-7-foreground = #ff5555
[network-base]
type = internal/network
interval = 5
format-connected = <label-connected>
format-disconnected = <label-disconnected>
label-disconnected = %{F#F0C674}%ifname%%{F#707880} disconnected
; The default module
;[module/wlan]
;inherit = network-base
;interface-type = wireless
;label-connected = %{F#F0C674}%ifname%%{F-} %essid% %local_ip%
[module/wlan]
type = internal/network
interface = wlo1
interval = 3.0
format-connected = <label-connected>
format-connected-prefix = " "
format-connected-prefix-foreground = ${colors.pink}
label-connected = %upspeed:5% %downspeed:5%
format-disconnected = <label-disconnected>
label-disconnected = not connected
label-disconnected-foreground = #66ffffff
format-padding = 0
[module/i3]
type = internal/i3
; ws-icon-[0-9]+ = label;icon
; NOTE: The label needs to match the name of the i3 workspace
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-default =
; NOTE: You cannot skip icons, e.g. to get a ws-icon-6
; you must also define a ws-icon-5.
; Available tags:
; <label-state> (default) - gets replaced with <label-(focused|unfocused|visible|urgent)>
; <label-mode> (default)
format = <label-state>
; Available tokens:
; %mode%
; Default: %mode%
label-mode = %mode%
label-mode-padding = 1
label-mode-background = #e60053
; Available tokens:
; %name%
; %icon%
; %index%
; %output%
; Default: %icon% %name%
label-focused = %icon%
label-focused-foreground = #E6E6FA
;label-focused-background = ${colors.blue-light-rain}
label-focused-background = #9370DB
label-focused-underline = #8A2BE2
label-focused-padding = 1
label-focused-font = 9
; Available tokens:
; %name%
; %icon%
; %index%
; %output%
; Default: %icon% %name%
label-unfocused = %icon%
label-unfocused-padding = 1
label-unfocused-font = 9
; Available tokens:
; %name%
; %icon%
; %index%
; %output%
; Default: %icon% %name%
label-visible = %index%
label-visible-underline = #555555
label-visible-padding = 1
; Available tokens:
; %name%
; %icon%
; %index%
; %output%
; Default: %icon% %name%
label-urgent = %index%
label-urgent-foreground = #000000
label-urgent-background = #bd2c40
label-urgent-padding = 1
; Separator in between workspaces
;label-separator = |
;label-separator-padding = 1
;label-separator-foreground = #ffb52a
; Only show workspaces defined on the same output as the bar
;
; Useful if you want to show monitor specific workspaces
; on different bars
;
; Default: false
;pin-workspaces = true
; This will split the workspace name on ':'
; Default: false
strip-wsnumbers = true
; Sort the workspaces by index instead of the default
; sorting that groups the workspaces by output
; Default: false
index-sort = true
; Create click handler used to focus workspace
; Default: true
enable-click = true
; Create scroll handlers used to cycle workspaces
; Default: true
enable-scroll = false
; Wrap around when reaching the first/last workspace
; Default: true
wrapping-scroll = false
; Set the scroll cycle direction
; Default: true
reverse-scroll = false
; Use fuzzy (partial) matching on labels when assigning
; icons to workspaces
; Example: code;♚ will apply the icon to all workspaces
; containing 'code' in the label
; Default: false
fuzzy-match = true
[module/rofi]
type = custom/script
;exec = echo " "
exec = echo " "
click-left = rofi -combi-modi run,drun,window,ssh -show drun -font "Monaco 15" -show combi -icon-them "Papirus" -show-icons
click-right = slock
;format-padding = 1
[module/date]
type = internal/date
interval = 1
date = %H:%M
date-alt = %Y-%m-%d %H:%M:%S
label = %date%
format-underline = ${colors.blue}
label-foreground = ${colors.pink}
[module/backlight]
type = internal/backlight
; Use the following command to list available cards:
; $ ls -1 /sys/class/backlight/
card = intel_backlight
; Available tags:
; <label> (default)
; <ramp>
; <bar>
format = <label>
format-prefix = " "
; Available tokens:
; %percentage% (default)
label = %percentage%
; Only applies if <ramp> is used
ramp-0 = 🌕
ramp-1 = 🌔
ramp-2 = 🌓
ramp-3 = 🌒
ramp-4 = 🌑
; Only applies if <bar> is used
bar-width = 10
bar-indicator = |
bar-fill = ─
bar-empty = ─
[module/weather]
type = custom/script
interval = 1800
exec = ~/.config/polybar/scripts/weather.sh
format-prefix = %{T10}%{T-}
format-prefix-background = ${colors.green2}
format-prefix-foreground = ${colors.foreground}
format-prefix-padding = 1
label = %{T2}%output:0:8:...%%{T-}
label-background = ${colors.pink}
label-foreground = ${colors.foreground}
label-padding = 1
[settings]
screenchange-reload = true
pseudo-transparency = true
; vim:ft=dosini
天气脚本
用了这个polybar主题中的天气脚本,自己修改了一下颜色