Absolutely! Here’s a basic but functional polybar configuration for Arch Linux with i3. This will include:
- Workspace module
- System tray
- CPU, memory, and disk usage
- Volume
- Network
- Date/time
- A launcher (Arch logo)
- And appropriate i3 IPC integration for workspace switching
✅ Prerequisites:
Make sure you have:
sudo pacman -S polybar
Also, ensure you have these tools installed for full functionality:
sudo pacman -S playerctl pulseaudio pavucontrol acpi networkmanager
📁 Structure
Let's assume your config file lives at:
~/.config/polybar/config.ini
📝 Config File Content
[bar/top]
width = 100%
height = 30
background = #222222
foreground = #ffffff
font-0 = "JetBrainsMono Nerd Font:size=10;2"
modules-left = arch i3
modules-center = date
modules-right = cpu memory disk volume network battery tray
tray-position = right
tray-padding = 2
[colors]
background = #222222
foreground = #ffffff
primary = #5294e2
secondary = #88c0d0
alert = #bf616a
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Modules
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[module/arch]
type = custom/text
content =
label = %content%
label-padding = 1
label-font = 1
click-left = rofi -show drun
[module/i3]
type = internal/i3
format = <label-state>
index-sort = true
wrapping-scroll = false
label-focused = %index% %name%
label-focused-background = ${colors.primary}
label-focused-underline = ${colors.primary}
label-unfocused = %index% %name%
label-unfocused-foreground = ${colors.foreground}
label-visible = %index% %name%
label-urgent = %index% %name%
label-urgent-background = ${colors.alert}
[module/cpu]
type = internal/cpu
interval = 2
format = <label>
label = %percentage%%
[module/memory]
type = internal/memory
interval = 3
format = 🧠 <label>
label = %percentage_used%%
[module/disk]
type = internal/fs
interval = 30
mount-0 = /
format-mounted = %mountpoint%: %percentage_used%%
[module/volume]
type = internal/pulseaudio
format-volume = 🔊 %volume%%
format-muted = 🔇 muted
label-muted-foreground = ${colors.secondary}
[module/network]
type = internal/network
interface = wlp2s0
interval = 3.0
format-connected = %essid% %local_ip%
format-disconnected = ⚠️ Disconnected
label-disconnected-foreground = ${colors.alert}
[module/date]
type = internal/date
interval = 1
date = "%Y-%m-%d"
time = "%H:%M:%S"
format = 🕒 <label>
label = %date% %time%
[module/battery]
type = internal/battery
battery = BAT0
adapter = AC
full-at = 98
format-charging = ⚡ %percentage%%
format-discharging = 🔋 %percentage%%
format-full = Full
[module/tray]
type = internal/systemtray
format-margin = 2
🔧 Launch Polybar from i3
Put this in your ~/.config/i3/config:
exec_always --no-startup-id killall -q polybar; polybar top &
Or a bit more robust:
exec_always --no-startup-id ~/.config/polybar/launch.sh
Create ~/.config/polybar/launch.sh:
#!/bin/bash
# Terminate already running bar instances
killall -q polybar
# Wait until the processes have been shut down
while pgrep -x polybar >/dev/null; do sleep 1; done
# Launch bar on each monitor
for m in $(polybar --list-monitors | cut -d":" -f1); do
MONITOR=$m polybar top &
done
Make it executable:
chmod +x ~/.config/polybar/launch.sh
✅ Notes:
- Adjust your network interface name (
interface = wlp2s0) using ip link.
- Make sure fonts like "JetBrainsMono Nerd Font" or "Noto Sans" are installed.
- You can swap
rofi in the launcher for dmenu if you prefer.
- You can add more modules like weather, media controls (Playerctl), etc.
Would you like a power menu, weather module, or media controls added as optional modules?