// Global 
{
    // "mode": "hide",
    "layer": "top",
    "position": "top",
    "margin-top": 3,
    "margin-left": 3,
    "margin-right": 3,
    "margin-bottom": 3,

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

    "modules-left": [
        "custom/launcher",
        "hyprland/workspaces",
        "hyprland/window",
    ],
 
    "modules-center": [
       // "custom/signal",
       // "custom/steam",
       // "custom/spotify",
       // "custom/firefox",
        "custom/slack",
        "custom/files",
        "custom/vpn",
    ],

    "modules-right": [
        "clock",
        // "network",  // using network applet in tray
        // "idle_inhibitor",
        "custom/storage",
        "memory",
        "cpu",
        "pulseaudio",
        "custom/keyboard-layout",
        "battery",
        "backlight",
        // "custom/neewer",
        "tray",
        //"custom/weather",
        "custom/power",
    ],

    // Modules

    "idle_inhibitor": {
        "format": "{icon} ",
        "format-icons":{
            "activated": "",
            "deactivated": ""
        }
    },

    "battery": {
        "states": {
            // "good": 95,
            "warning": 30,
            "critical": 15
        },
        "format": "{icon}  {capacity}%",
        "format-charging": "{capacity}% 󰂄",
        "format-plugged": "{capacity}% ",
        // "format-good": "", // An empty format will hide the module
        // "format-full": "",
        "format-icons": ["", "", "", "", ""]
    },

    "clock": {
        "interval": 1,
        // "format-alt": " {:%e %b %Y}", // Icon: calendar-alt
        "format": "{:%I:%M.%S %p}",
        "tooltip-format": "{:%e %B %Y}"
    },

    "cpu": {
        "interval": 5,
        "format": "  {usage}%", // Icon: microchip
        "states": {
            "warning": 70,
            "critical": 90,
        },
        "on-click": "ghostty -e 'htop'",
    },

    "memory": {
        "interval": 5,
        "format": "  {}%", // Icon: memory
        "on-click": "ghostty -e 'htop'",
        "states": {
            "warning": 70,
            "critical": 90
        }
    },

    "network": {
        "interval": 5,
        "format-wifi": "", // Icon: wifi
        "format-ethernet": "  {ifname}: {ipaddr}/{cidr}", // Icon: ethernet
        "format-disconnected": "⚠  Disconnected",
        "tooltip-format": "{essid} - {ifname}:{ipaddr}  {bandwidthUpBytes} {bandwidthDownBytes}",
        "on-click": "ghostty -e 'nmtui'",
    },
    "network#vpn": {
        "interface": "tun0",
        "format": "  {signalStrength}%",
        "format-disconnected": "⚠  Disconnected",
        "tooltip-format": "{essid} - {ifname}:{ipaddr}  {bandwidthUpBytes} {bandwidthDownBytes}",
    },

    "hyprland/window": {
        "format": "{}",
        "max-length": 60,
        "icon": true,
        "icon_size": 30,
        "rewrite": {
            // Firefox
            "(.*) — Mozilla Firefox": " $1",
            "(.*) - Mozilla Firefox": " $1",
            "Mozilla Firefox": " Firefox",

            // Chrome/Chromium
            "(.*) - Google Chrome": " $1",
            "(.*) - Chromium": " $1",
            "Google Chrome": " Chrome",
            "Chromium": " Chromium",

            // Terminal applications
            "(.*) - zsh": " $1",
            "(.*) - bash": " $1",
            "(.*) - fish": " $1",
            "ghostty": " Terminal",
            "kitty": " Terminal",
            "alacritty": " Terminal",
            "ghostty": " Terminal",

            // Text editors and IDEs
            "(.*) - Visual Studio Code": " $1",
            "(.*) - Code": " $1",
            "(.*) - Vim": " $1",
            "(.*) - Neovim": " $1",
            "(.*) - Emacs": " $1",
            "Visual Studio Code": " VS Code",

            // File managers
            "(.*)Nautilus": " Files: $1",
            "Files": " Files",
            "Thunar": " Files",
            "Dolphin": " Files",

            // Communication apps
            "Slack (.*)": " $1",
            "Slack": " Slack",  
            "Signal": " Signal",
            "Discord": " Discord",
            "Telegram": " Telegram",

            // Media and entertainment
            "Spotify": " Spotify",
            "Steam": " Steam",
            "(.*) - YouTube": "󰗃 $1",
            "VLC media player": "󰕼 VLC",

            // Development tools
            "(.*) - GitHub": " $1",
            "GitKraken": " GitKraken",
            "Postman": " Postman",

            // System applications
            "System Monitor": " System Monitor",
            "Task Manager": " Task Manager",
            "Settings": " Settings",
            "Control Panel": " Settings",

            // Office applications
            "(.*) - LibreOffice Writer": " $1",
            "(.*) - LibreOffice Calc": " $1",
            "(.*) - LibreOffice Impress": " $1",

            // Remove common suffixes that don't add value
            "^(.*) - .*$": "$1",
            "^(.*) | .*$": "$1",

            // Fallback for empty/unnamed windows
            "^$": "Desktop"
        }
    },

    "hyprland/workspaces": {
        "disable-scroll": true,
        "disable-markup" : false,
        "all-outputs": true,
        "show-special": true,
        "special-visible-only": true,
        "format": "  {icon}  ",
        "format-icons": {
            "1": "",
            "2": "",
            "3": "󰭻",
            "4": "",
            "5": " 5",
            "6": " 6",
            "7": " 7",
            "8": " 8",
            "9": " 9",
            "music": "",
            "scratch": "",
        }
    },

    "pulseaudio": {
        "scroll-step": 1, // %, can be a float
        "format": "{icon}  {volume}%",
        "format-bluetooth": "{volume}% {icon}  {format_source}",
        "format-bluetooth-muted": " {icon}  {format_source}",
        "format-muted": " {format_source}",
        "format-source": "{volume}% ",
        "format-source-muted": "",
        "format-icons": {
            "headphone": ["", "", "", "", ""],
            "hands-free": "",
            "headset": "",
            "phone": "",
            "portable": "",
            "car": "",
            "default": ["", "", ""]
        },
        "on-click": "pavucontrol",
        "on-scroll-up": "pactl set-sink-volume @DEFAULT_SINK@ +2%",
        "on-scroll-down": "pactl set-sink-volume @DEFAULT_SINK@ -2%",
    },

    // "custom/temp": {
    //     "exec": "notify-send \"temp thing\"",
    //     "interval": "once",
    //     "signal": 8,
    // },

    "tray": {
        "icon-size": 20,
        "spacing":10,
     },

    "backlight": {
        "format": "{icon}  {percent}%",
        "format-icons": ["󰹐", "󱩏", "󱩑", "󱩓", "󱩕", "󰛨"],
        "on-scroll-down": "brightnessctl -c backlight set 1%-",
        "on-scroll-up": "brightnessctl -c backlight set +1%",
        "min-brightness": 1
    },

    // Add this configuration block
    "custom/neewer": {
        "format": "{}",
        "return-type": "json",
        "exec": "~/nixos/nate-work/dotfiles/waybar/scripts/waybar-neewer.sh status",
        "interval": 10,
        "on-click-middle": "~/nixos/nate-work/dotfiles/waybar/scripts/waybar-neewer.sh toggle",
        "on-click": "~/nixos/nate-work/dotfiles/waybar/scripts/waybar-neewer.sh decrease",
        "on-click-right": "~/nixos/nate-work/dotfiles/waybar/scripts/waybar-neewer.sh increase",
        "tooltip": true
    },

    "custom/storage": {
        "format": "{icon}  {percentage}%",
        "format-icons": {
          "default": "",
          "warning": "",
          "critical": "",
        },
        "exec": "usage=$(df / --output=pcent | tail -n1 | tr -d ' %'); if [ $usage -ge 90 ]; then class=\"critical\"; elif [ $usage -ge 75 ]; then class=\"warning\"; else class=\"default\"; fi; echo \"{\\\"percentage\\\":$usage,\\\"class\\\":\\\"$class\\\"}\"",
        "return-type": "json",
        "interval": 30,
        "tooltip-format": "Root filesystem: {percentage}% used",
    },

    "custom/signal": {
        "format": "  ",
        "on-click": "exec signal",
        "tooltip": false,
    },

    "custom/steam": {
        "format": "  ",
        "on-click": "exec steam",
        "tooltip": false,
    },

    "custom/spotify": {
        "format": "  ",
        "on-click": "exec flatpak run com.spotify.Client",
        "tooltip": false,
    },

    "custom/firefox": {
        "format": "  ",
        "on-click": "exec firefox",
        "tooltip": false,
    },


    "custom/slack": {
        "format": "  ",
        "on-click": "slack",
        "tooltip": false,
        "exec if": "pgrep slack"
    },


   "custom/files": {
        "format": " 󰉋 ",
        "on-click": "exec nautilus",
        "tooltip": false,
    },

    "custom/vpn": {
        "format": "{}",
        "return-type": "json",
        "exec": "~/.config/waybar/scripts/waybar-vpn.sh status",
        "interval": 5,
        "on-click": "~/.config/waybar/scripts/waybar-vpn.sh toggle",
        "tooltip": true
    },

    "custom/launcher": {
        "format":" ",
        "on-click": "exec wofi -c ~/.config/wofi/config -I",
        "tooltip": false,
    },

    "custom/power": {
        "format":"⏻",
        "on-click": "exec ~/.config/waybar/scripts/power-menu.sh",
        "tooltip": false,
    },
}
