Polybar - ulises-jeremias/dotfiles GitHub Wiki
๐จ Polybar Configuration Guide
Polybar is a highly customizable status bar that provides a sleek and elegant way to display system information such as date, CPU, memory, and more. It's modular, lightweight, and visually beautiful.
This dotfiles setup uses a profile-based system that allows different rice themes to use different polybar configurations seamlessly, with intelligent color adaptation powered by the smart colors system.
[!TIP] Everything in this setup is fully customizable. Whether it's modules, colors, font, spacing, or interaction, you have total control. All configuration files are versioned in your dotfiles using chezmoi.
Key Features
- ๐จ Smart Color Integration: Automatic theme-adaptive color selection
- ๐ Profile System: Different configurations for different rice themes
- ๐ง 20+ Modules: Comprehensive system monitoring and controls
- ๐ Auto-Launch: Seamless startup with window manager integration
- โก Performance: Optimized for low resource usage
๐ Configuration Files Location
Your Polybar configuration is stored in:
~/.config/polybar
โโโ launch.sh # Enhanced launch script with profile support
โโโ profiles/ # Profile definitions
โ โโโ default.sh # Default profile (2 bars)
โ โโโ minimal.sh # Minimal profile (1 bar)
โโโ configs/ # Configuration files
โโโ default/
โโโ config.ini # Main polybar config
โโโ modules.conf # Module definitions
โโโ bars.conf # Bar configurations (centralized)
โโโ bars/ # Individual bar configurations
To edit it:
chezmoi edit ~/.config/polybar --source ~/.dotfiles
Apply changes with:
chezmoi apply
๐ฏ Profile System
How It Works
- Rice Configurations specify which polybar profile to use via
POLYBAR_PROFILE
variable - Profiles define which bars to launch and which config file to use
- Launch script automatically loads the correct profile based on your current rice
Available Profiles
default
- Full setup with top and bottom barsminimal
- Minimal setup with only top bar
Creating New Profiles
Create a new profile in ~/.config/polybar/profiles/
:
#!/usr/bin/env bash
#
# My Custom Profile
#
POLYBAR_PROFILE_NAME="custom"
POLYBAR_PROFILE_DESCRIPTION="My custom polybar setup"
# Bars to launch (window manager aware)
POLYBAR_PROFILE_BARS=("polybar-top")
WM=$(wmctrl -m | grep -oE 'Name: .*' | cut -d' ' -f2 | tr '[:upper:]' '[:lower:]' 2>/dev/null || echo "unknown")
if [ "${WM}" = "i3" ]; then
POLYBAR_PROFILE_BARS=("i3-polybar-top")
fi
# Config file to use
POLYBAR_PROFILE_CONFIG_FILE="$HOME/.config/polybar/configs/default/config.ini"
Using Profiles in Rice Configs
In your rice's config.sh
file:
#!/usr/bin/env bash
# Polybar profile to use for this rice
POLYBAR_PROFILE="minimal" # or "default", "custom", etc.
๐ Launch Script Commands
The enhanced launch script provides comprehensive polybar management:
~/.config/polybar/launch.sh [COMMAND]
# Commands:
start # Start polybar with current rice profile
stop # Stop all polybar processes
restart # Restart polybar (most common)
status # Show current status
help # Show help
Examples
# Restart polybar (automatically uses current rice profile)
~/.config/polybar/launch.sh restart
# Show current status
~/.config/polybar/launch.sh status
# Force restart
~/.config/polybar/launch.sh restart --force
๐ง What You Can Customize
- Bars: Define multiple bars for different monitors or purposes
- Modules: Choose what system info to display (CPU, memory, network, etc.)
- Fonts & Colors: Set font family, size, and colors (supports Nerd Fonts!)
- Spacing & Alignment: Adjust padding, margins, and alignment
- Behavior: Define click actions, scroll behavior, or auto-hide logic
๐๏ธ Main Files
config.ini
: Main config file defining bars and module layoutmodules/
: Folder containing reusable and custom module logiclaunch.sh
: Enhanced launch script with profile support
๐ฆ Default Modules Available
Polybar supports a variety of built-in and custom modules. Some examples:
date
โ current date/timecpu
โ CPU usagememory
โ RAM usagebattery
โ battery statusnetwork
โ current IP, Wi-Fi, and signalspotify
โ current playing tracki3
โ workspace info for i3 userscustom/
โ your own shell scripts or output
Check the documentation we have for each module in the sidebar!
๐จ Visual Styling Tips
- Use
pywal
to dynamically theme your bar based on wallpaper - Integrate with icon fonts like Material Design or Nerd Fonts for better visuals
- Adjust background transparency with a compositor like
picom
๐งช Testing Your Setup
Make changes incrementally and restart the polybar:
~/.config/polybar/launch.sh restart
To check status:
~/.config/polybar/launch.sh status
๐ซ Disabling Polybar for a Rice
If you want a rice that doesn't use polybar at all, you can either:
- Omit the
POLYBAR_PROFILE
variable - the system will fall back to defaults - Set an empty profile - create a profile that launches no bars
- Use a different status bar - the profile system is flexible
๐ Need Help?
Design your own status bar and make your desktop truly yours. The profile system makes it easy to have different configurations for different themes! ๐