Close Menu
    Facebook X (Twitter) Instagram
    Command Linux
    • About
    • How to
      • Q&A
    • OS
      • Windows
      • Arch Linux
    • AI
    • Gaming
      • Easter Eggs
    • Statistics
    • Blog
      • Featured
    • MORE
      • IP Address
      • Man Pages
    • Write For Us
    • Contact
    Command Linux
    Home - Arch Linux - Waybar Config Guide

    Waybar Config Guide

    WillieBy WillieDecember 11, 2025Updated:December 11, 2025No Comments3 Mins Read

    Waybar is a status bar for Wayland compositors like Sway and Hyprland. It uses JSONC for configuration and CSS for styling. This guide covers waybar config file setup, module placement, and customization.

    Install Waybar on Linux

    Install Waybar using your distribution’s package manager.

    On Debian and Ubuntu:

    $ sudo apt install waybar

    On Fedora:

    $ sudo dnf install waybar

    On Arch Linux:

    $ sudo pacman -S waybar
    Tip: Ubuntu users can add a PPA for newer versions with sudo add-apt-repository ppa:nschloe/waybar.

    Waybar Config File Location

    Waybar searches for configuration files in this order:

    PriorityLocation
    1$XDG_CONFIG_HOME/waybar/config.jsonc
    2~/.config/waybar/config.jsonc
    3/etc/xdg/waybar/config.jsonc

    Copy the default config to your home directory:

    $ mkdir -p ~/.config/waybar
    $ cp /etc/xdg/waybar/config.jsonc ~/.config/waybar/
    $ cp /etc/xdg/waybar/style.css ~/.config/waybar/
    Note: Use a text editor with JSONC support like VS Code or Neovim to avoid syntax errors.

    Waybar Config Structure

    The waybar config file uses key-value pairs in JSONC format. Three main arrays control module placement: modules-left, modules-center, and modules-right.

    Basic Config Example

    {
        "layer": "top",
        "position": "top",
        "modules-left": ["sway/workspaces", "sway/mode"],
        "modules-center": ["clock"],
        "modules-right": ["cpu", "memory", "battery"],
        "clock": {
            "format": "{:%H:%M}"
        },
        "battery": {
            "format": "{capacity}% {icon}",
            "format-icons": ["", "", "", "", ""]
        }
    }

    Common Settings

    KeyValueDescription
    layertop/bottomBar appears above or below windows
    positiontop/bottom/left/rightBar placement on screen
    heightintegerBar height in pixels
    spacingintegerGap between modules in pixels

    Configure Waybar Modules

    Each module displays specific system information. Define modules after placing them in position arrays.

    Clock Module

    "clock": {
        "format": "{:%I:%M %p}",
        "format-alt": "{:%Y-%m-%d}",
        "tooltip-format": "{calendar}"
    }

    The format-alt key shows alternate text when clicked.

    Battery Module

    "battery": {
        "interval": 60,
        "states": {
            "warning": 30,
            "critical": 15
        },
        "format": "{capacity}% {icon}",
        "format-icons": ["", "", "", "", ""]
    }

    Workspaces Module

    For Hyprland, use hyprland/workspaces instead of sway/workspaces:

    "hyprland/workspaces": {
        "format": "{icon}",
        "on-click": "activate",
        "persistent-workspaces": {
            "*": 5
        }
    }

    Custom Modules

    Create custom modules with the custom/ prefix:

    "custom/power": {
        "format": "⏻",
        "on-click": "wlogout"
    }
    Warning: Custom scripts must be executable. Run chmod +x script.sh before use.

    Style Waybar with CSS

    The ~/.config/waybar/style.css file controls appearance. Target modules using CSS selectors.

    * {
        font-family: "JetBrains Mono";
        font-size: 13px;
    }
    
    window#waybar {
        background: rgba(30, 30, 46, 0.9);
        color: #cdd6f4;
    }
    
    #clock {
        padding: 0 10px;
        color: #f9e2af;
    }
    
    #battery.warning {
        color: #fab387;
    }
    
    #battery.critical {
        color: #f38ba8;
    }
    CSS SelectorTarget
    window#waybarMain bar container
    #clockClock module
    #batteryBattery module
    #custom-powerCustom power module

    Start Waybar Automatically

    Add the autostart command to your compositor config.

    For Hyprland, add to ~/.config/hypr/hyprland.conf:

    exec-once = waybar

    For Sway, add to ~/.config/sway/config:

    bar {
        swaybar_command waybar
    }

    Reload Waybar after config changes:

    $ pkill waybar && waybar &
    Tip: Run waybar -l debug to troubleshoot configuration errors.

    FAQs

    The waybar config file is located at ~/.config/waybar/config.jsonc. System defaults exist at /etc/xdg/waybar/.

    Run pkill waybar && waybar & in a terminal. Alternatively, send SIGUSR2 with killall -SIGUSR2 waybar to reload.

    Yes. Replace sway/workspaces with hyprland/workspaces and sway/window with hyprland/window in your config.

    Install a Nerd Font like otf-font-awesome or ttf-jetbrains-mono-nerd. Set the font in your style.css file.

    Waybar uses JSONC format, which is JSON with comment support. Configuration files end in .jsonc or config.

    Willie
    • Website

    Willie has over 15 years of experience in Linux system administration and DevOps. After managing infrastructure for startups and enterprises alike, he founded Command Linux to share the practical knowledge he wished he had when starting out. He oversees content strategy and contributes guides on server management, automation, and security.

    Related Posts

    Arch Based Distros You Should Try in 2026

    March 19, 2026

    How to Set Up Spotify Arch Linux

    March 18, 2026

    How To Use Nmcli Connect To Wi-Fi on Linux

    March 14, 2026

    How to Do a Zsh Install on Any Linux Distro

    March 13, 2026
    Top Posts

    Building Modern Apps While Living in the Terminal

    March 9, 2026

    How to Change Owner of Folder Linux

    February 19, 2026

    BASENAME

    February 19, 2026

    DEBIAN-DISTRO-INFO

    April 1, 2026
    • Home
    • Contact Us
    • Privacy Policy
    • Terms of Use

    Type above and press Enter to search. Press Esc to cancel.