// =============================================================================
//
// Waybar configuration
//
// Configuration reference: https://github.com/Alexays/Waybar/wiki/Configuration
//
// =============================================================================

{
    // -------------------------------------------------------------------------
    // Global configuration
    // -------------------------------------------------------------------------

    "layer": "top",
    "output": "!HDMI-A-1",
    "position": "top",

    // If height property would be not present, it'd be calculated dynamically
    "height": 30,

    "modules-left": [
        "hyprland/workspaces",
    ],
    "modules-center": [
        "custom/hostname",
        "clock",
    ],
    "modules-right": [
        "tray",
        "custom/separator",
        "wireplumber", 
        "custom/separator",
        "network",
        "custom/separator",
        "memory",
        "custom/separator",
        "cpu",
    ],


    // -------------------------------------------------------------------------
    // Modules
    // -------------------------------------------------------------------------

    "custom/hostname": {
        "format": "{text} - ",
        "exec": "$HOME/linuxbox/hostname.sh",
        "interval": "once",
        "tooltip": false
    },

    "custom/separator": {
        "format": "|",
        "interval": "once",
        "tooltip": false
    },

    "wireplumber": {
        "format": "VOL:{volume:03}%",
        "format-muted": "VOL:---%",
        "max-volume": 150,
        "scroll-step": 0.2,
    },
    
    "clock": {
        "interval": 10,
        "format": "{:%A - %B %d %Y - %R}",
    },

    "cpu": {
        "interval": 5,
        "format": "CPU:{usage:02}% {avg_frequency:0.1f}Ghz", 
        "states": {
          "warning": 70,
          "critical": 90
        },
    },

    "memory": {
        "interval": 10,
        "format": "RAM:{used:0.1f}G/{total:0.1f}G", 
        "states": {
            "warning": 70,
            "critical": 90
        },
        "tooltip-format": "RAM used: {percentage}%\nSWAP used: {swapPercentage}%"
    },

    "network": {
        "interval": 5,
        "format-wifi": "ETH:{ipaddr} {essid} ({signalStrength}%)", 
        "format-ethernet": "ETH:{ipaddr}", 
        "format-disconnected": "ETH:Disconnected",
        "format-linked": "ETH:Pending",
        "tooltip-format": "{ifname}: {ipaddr}"
    },

    "hyprland/window": {
        "format": " {}",
        "max-length": 120
    },

    "hyprland/workspaces": {
        "all-outputs": false,
        "disable-scroll": true,
        "sort-by-name": true,
        "sort-by-coordinates": false,
        "format": " {name} ",
    },

    "tray": {
        "icon-size": 15,
        "spacing": 15
    }
}
