Polybar
Polybar works great with Xfce and -currently chosen- i3. So let's get started.
First steps:
1. Installing Polybar
Ubuntu / Debian:
sudo apt install polybar
How does it work?
Polybar requires a custom shell script to run. To launch it automatically on startup, you just need to add this script to your i3 configuration.
launch.sh#!/usr/bin/env bash
# Close all running polybars to prevent duplication
polybar-msg cmd quit 2>/dev/null
killall -q polybar
# Wait for them to close
while pgrep -x polybar >/dev/null; do sleep 0.2; done
sleep 1
# Creating Logs
echo "---" | tee -a /tmp/polybar-mybar.log
# Activate Top bar
polybar <Bar_Name> 2>&1 | tee -a /tmp/polybar-mybar.log & disown
# Optional: If you want to activate a Bottom bar, uncomment the lines below:
# echo "---" | tee -a /tmp/polybar-bottom.log
# polybar bottom 2>&1 | tee -a /tmp/polybar-bottom.log & disown
echo "Bars launched..."
Note: Don't forget to make the script executable by running this command in your terminal:
chmod +x ~/.config/polybar/launch.sh
I'll explain what polybar bottom [...] is all about later.
If you are using i3, open your config file (~/.config/i3/config) and add the following line:
exec --no-startup-id $HOME/.config/polybar/launch.sh
Note: This command executes the script on startup. The --no-startup-id flag disables startup-notification support for this particular command, preventing a spinning loading cursor.
Refresh your i3 ( Ctrl+Shift+R ) And Voila! you have very simple status bar. Let's go customize it.
2. Explanation
Now that Polybar is installed and running, we have to answer one key question: "How do I want it to look?"
If you already have an idea, that's good.
In accordance with its structure, it consists of:
[colors]- Palette definitions.[bar/<Name>]- Bar layout configuration.[module/<Name>]- Modules to display on the bar.
In this section, you define the color palette, and you can name the variables whatever you like:
[colors]
background = #383C3D
...
This determines the properties of the bar you want to be displayed, such as border-<X> or tray-<X>.
You can change the name "mybar" to whatever you prefer:
[bar/mybar]
width = 100%
height = 20pt
...
This section determines how the module is configured and what it displays. In this case, it is the module responsible for showing workspaces:
[module/xworkspaces]
type = internal/xworkspaces:
label-active = %name%
label-active-background = ${colors.background-alt}
label-active-underline= ${colors.primary}
...
Note: Some modules are already built-in/predefined in polybar so you just need to look at the polybar documentation
3. Configuring a Second Bar
To start with, you will have a basic setup with built-in modules like date, xworkspaces, and xwindow.
However, it is also possible (and very common) to attach your own custom scripts to Polybar. Honestly, using Bash scripts can sometimes be even easier than configuring the built-in modules.
To create a second bar (for example, at the bottom of your screen), you need to define a new [bar/<Name>] section in your config. You don't need to rewrite everything from scratch, just specify the key properties like this:
[bar/bottom]
width = 100%
height = 20pt
bottom = true
background = ${colors.background}
foreground = ${colors.foreground}
line-size = 0
line-height = 24
#font-0 = monospace;2
font-0 = FiraCode Nerd Font:size=11
font-1 = Noto Color Emoji:scale=10
border-size = 0
border-color = #00000000
padding-left = 0
padding-right = 2
padding-top = 10
padding-bottom = 0
module-margin = 1
separator = ][
separator-foreground = ${colors.disabled}
modules-left = memory cpu
and modules in modules sections:
[module/memory]
type = internal/memory
interval = 2
format-prefix = "RAM "
format-prefix-foreground = ${colors.primary}
label = %percentage_used:2%%
[module/cpu]
type = internal/cpu
interval = 2
format-prefix = "CPU: "
format-prefix-foreground = ${colors.primary}
label = %percentage:2%%
[module/filesystem]
type = internal/fs
interval = 25
mount-0 = /
label-mounted = %{F#F0C674}%mountpoint%:%{F-} %used:GB%/%total:GB%
label-unmounted = %mountpoint% not mounted
label-unmounted-foreground = ${colors.disabled}
Note:
1. Don't forget to go back to your launch.sh script and uncomment lines 18 and 19, which are responsible for launching the bottom bar!
2. The required fonts must be installed on your system, otherwise Polybar will throw an error.
Now it's time to execute launch.sh... Nothing happened? Or maybe only one bar showed up?
Well, there is one important thing you need to know about executing scripts in Linux.
By default, if you just type launch.sh, your system looks for this file inside your $PATH. But even if you have added your Polybar folder to the $PATH variable, the second (bottom) bar often fails to refresh or load properly without a direct reference.
To avoid these glitches and make sure both bars render correctly every single time, you should always execute the script using its specific absolute or relative path:
./launch.sh # If you are already inside ~/.config/polybar/
# OR (Highly Recommended)
~/.config/polybar/launch.sh
Keep in mind that even if you refresh your i3 wm (Ctrl+Shift+R), simply running launch.sh without its exact path might still result in a "command not found" error, or it will simply fail to spawn the bottom bar. Always point directly to the source!
For the full Polybar setup, just check out my GitHub profile-I will link the configuration files and shell scripts there.
And that's it! Now you have two bars ready for your customization as well.