//  __  __           _       _
// |  \/  | ___   __| |_   _| | ___  ___
// | |\/| |/ _ \ / _` | | | | |/ _ \/ __|
// | |  | | (_) | (_| | |_| | |  __/\__ \
// |_|  |_|\___/ \__,_|\__,_|_|\___||___/
//
//
// by Stephan Raabe (2023)
// -----------------------------------------------------
//
{
    // Workspaces
    "hyprland/workspaces": {
        "on-click": "activate",
        "active-only": false,
        "all-outputs": true,
        "format": "{}",
        "format-icons": {
            "urgent": "",
            "active": "",
            "default": ""
        },
        "persistent-workspaces": {
            // START WORKSPACES
            "*": 3
            // END WORKSPACES
        }
    },
    // Taskbar
    "wlr/taskbar": {
        "format": "{icon}",
        "icon-size": 16,
        "tooltip-format": "{title}",
        "on-click": "activate",
        "on-click-middle": "close",
        "ignore-list": [
            "Alacritty",
            "kitty-dropterm",
            "kitty",
            "alacritty-dropterm",
            "chrome-chatgpt.com__-Default"
        ],
        "app_ids-mapping": {
            "firefoxdeveloperedition": "firefox-developer-edition"
        },
        "rewrite": {
            "Firefox Web Browser": "Firefox",
            "Foot Server": "Terminal"
        }
    },
    // Hyprland Window
    "hyprland/window": {
        "rewrite": {
            "(.*) - Brave": "$1",
            "(.*) - Chromium": "$1",
            "(.*) - Brave Search": "$1",
            "(.*) - Outlook": "$1",
            "(.*) Microsoft Teams": "$1",
            "(.*) - Google Chrome": "$1",
            "(.*) - Visual Studio Code": "$1",
            "(.*) _哔哩哔哩*": "$1",
            "imv - (.*)": "$1"
        },
        "separate-outputs": true
    },
    // Empty
    "custom/empty": {
        "format": ""
    },
    // Cliphist
    "custom/cliphist": {
        "format": "",
        "on-click": "sleep 0.1 && ~/dotfiles/scripts/cliphist.sh",
        "on-click-right": "sleep 0.1 && ~/dotfiles/scripts/cliphist.sh d",
        "on-click-middle": "sleep 0.1 && ~/dotfiles/scripts/cliphist.sh w",
        "tooltip": false
    },
    // Updates Count
    "custom/updates": {
        "format": " {}",
        "tooltip-format": "{}",
        "escape": true,
        "return-type": "json",
        "exec": "~/dotfiles/scripts/updates.sh",
        "restart-interval": 60,
        "on-click": "alacritty --class dotfiles-floating -e ~/dotfiles/scripts/installupdates.sh",
        "tooltip": false
    },
    // Wallpaper
    "custom/wallpaper": {
        "format": "",
        "on-click": "~/dotfiles/hypr/scripts/wallpaper.sh select",
        "on-click-right": "~/dotfiles/hypr/scripts/wallpaper.sh",
        "tooltip": false
    },
    // Waybar Themes
    "custom/waybarthemes": {
        "format": "",
        "on-click": "~/dotfiles/waybar/themeswitcher.sh",
        "tooltip": false
    },
    // Keybindings
    "custom/keybindings": {
        "format": "",
        "on-click": "~/dotfiles/hypr/scripts/keybindings.sh",
        "tooltip": false
    },
    // Filemanager Launcher
    "custom/filemanager": {
        "format": "",
        "on-click": "~/dotfiles/.settings/filemanager.sh",
        "tooltip": false
    },
    // Outlook Launcher
    "custom/outlook": {
        "format": "",
        "on-click": "chromium --app=https://outlook.office.com/mail/",
        "tooltip": false
    },
    // Browser Launcher
    "custom/browser": {
        "format": "",
        "on-click": "~/dotfiles/.settings/browser.sh",
        "tooltip": false
    },
    // ChatGPT Launcher
    "custom/chatgpt": {
        "format": " ",
        "on-click": "chromium --app=https://chat.openai.com",
        "tooltip": false
    },
    // Calculator
    "custom/calculator": {
        "format": "",
        "on-click": "qalculate-gtk",
        "tooltip": false
    },
    // Windows VM
    "custom/windowsvm": {
        "format": "",
        "on-click": "~/dotfiles/scripts/launchvm.sh",
        "tooltip": false
    },
    // Rofi Application Launcher
    "custom/appmenu": {
        // START APPS LABEL
        "format": "Apps",
        // END APPS LABEL
        "on-click": "sleep 0.2;rofi -show drun -replace",
        "on-click-right": "~/dotfiles/hypr/scripts/keybindings.sh",
        "tooltip": false
    },
    // Rofi Application Launcher
    "custom/appmenuicon": {
        "format": "",
        "on-click": "rofi -show drun -replace",
        "on-click-right": "~/dotfiles/hypr/scripts/keybindings.sh",
        "tooltip": false
    },
    // Power Menu
    "custom/exit": {
        "format": "",
        "on-click": "wlogout",
        "tooltip": false
    },
    // Keyboard State
    "keyboard-state": {
        "numlock": true,
        "capslock": true,
        "format": "{name} {icon}",
        "format-icons": {
            "locked": "",
            "unlocked": ""
        }
    },
    "group/tray": {
        "orientation": "inherit",
        "drawer": {
            "transition-duration": 300,
            "children-class": "not-memory",
            "transition-left-to-right": false
        },
        "modules": [
            "tray"
        ]
    },
    // System tray
    "tray": {
        "icon-size": 16,
        "spacing": 8,
        "verse-direction": true
    },
    // Clock
    "clock": {
        "calendar": {
            "mode": "year",
            "mode-mon-col": 3,
            "weeks-pos": "right",
            "on-scroll": 1,
            "format": {
                "months": "<span color='#ffead3'><b>{}</b></span>",
                "days": "<span color='#ecc6d9'><b>{}</b></span>",
                "weeks": "<span color='#99ffdd'><b>W{}</b></span>",
                "weekdays": "<span color='#ffcc66'><b>{}</b></span>",
                "today": "<span color='#ff6699'><b><u>{}</u></b></span>"
            }
        },
        // TIMEDATEFORMAT
        "format": "{:%B %d %H:%M %a}",
        // "timezone": "America/New_York",
        "tooltip-format": "<big>{:%Y %B %d}</big>\n<tt><small>{calendar}</small></tt>",
        // START CLOCK FORMAT
        "format-alt": "{:%Y-%m-%d}"
        // END CLOCK FORMAT
    },
    // spacer
    "custom/spacer": {
        "format": " ",
        "tooltip": false
    },
    // div
    "custom/div": {
        "format": "",
        "tooltip": false
    },
    // CPU
    "cpu": {
        "format": "󰒇 {usage}%",
        "on-click": "alacritty -e htop",
        "interval": 5,
        "states": {
            "warning": 50,
            "critical": 90
        }
    },
    // "cpu#bar": {
    //     "format": "{icon}",
    //     "format-icons":[
    //         "▏ ","▎ ","▍ ","▌ ","▋ ","▊ ","▉ ","█ ","█▏","█▎","█▍","█▌","█▋","█▊","█▉","██"
    //     ]
    // },
    // Memory
    "memory": {
        "format": " {used:0.1f}G",
        "tooltip-format": "{total:0.1f}G total\n{swapTotal:0.1f}G swap\n{used:0.1f}G used\n{avail:0.1f}G free\n{percentage}% used",
        "on-click": "alacritty -e htop",
        "interval": 10,
        "states": {
            "warning": 50,
            "critical": 80
        }
    },
    // Harddisc space used
    "disk": {
        "interval": 30,
        "format": "D {percentage_used}% ",
        "path": "/",
        "on-click": "alacritty -e htop"
    },
    "hyprland/language": {
        "format": "/ K {short}"
    },
    // Group Hardware
    "group/hardware": {
        "orientation": "inherit",
        "modules": [
            "network#speed",
            "custom/div",
            "cpu",
            "custom/div",
            "memory"
        ]
    },
    "group/hardware2": {
        "orientation": "inherit",
        "modules": [
            "pulseaudio",
            "custom/div",
            "network"
            // "custom/div",
            // "battery",
            // "battery#charging"
        ]
    },
    // Group system settings
    "group/systems": {
        "orientation": "inherit",
        "modules": [
            // "user",
            "clock"
        ]
    },
    "group/power": {
        "orientation": "inherit",
        "drawer": {
            "transition-duration": 300,
            "children-class": "not-memory",
            "transition-left-to-right": false
        },
        "modules": [
            "custom/exit",
            "idle_inhibitor"
        ]
    },
    // Group Settings
    "group/settings": {
        "orientation": "horizontal",
        "modules": [
            // START CHATGPT TOOGLE
            "custom/chatgpt",
            // END CHATGPT TOOGLE
            "custom/settings",
            "custom/waybarthemes",
            "custom/wallpaper"
        ]
    },
    // Group Quicklinks
    "group/quicklinks": {
        "orientation": "horizontal",
        "modules": [
            "custom/browser",
            "custom/filemanager",
        ]
    },
    // Network
    "network": {
        "format": "{ifname}",
        "format-wifi": "{icon} {signalStrength}%",
        "format-ethernet": " wired",
        "format-disconnected": "󰌙",
        "tooltip-format": " {ifname} via {gwaddri}",
        "tooltip-format-wifi": "  {ifname} @ {essid}\nIP: {ipaddr}\nStrength: {signalStrength}%\nFreq: {frequency}MHz\nUp: {bandwidthUpBits} Down: {bandwidthDownBits}",
        "tooltip-format-ethernet": " {ifname}\nIP: {ipaddr}\n up: {bandwidthUpBits} down: {bandwidthDownBits}",
        "tooltip-format-disconnected": "Disconnected",
        "max-length": 50,
        "on-click": "~/dotfiles/.settings/networkmanager.sh",
        "format-icons": [
            "󰤯",
            "󰤟",
            "󰤢",
            "󰤥",
            "󰤨"
        ]
    },
    "network#speed": {
        "format": " {bandwidthTotalBits}",
        "tooltip-format": " {bandwidthUpBits}\n {bandwidthDownBits}",
        "interval": 5
    },
    // Battery
    "battery": {
        "states": {
            // "good": 95,
            "warning": 30,
            "critical": 15
        },
        "format": "{icon} {capacity}%",
        "format-charging": "",
        "format-plugged": "  {capacity}%",
        "format-alt": "{icon}  {time}",
        // "format-good": "", // An empty format will hide the module
        "format-full": "󱟢 {capacity}%",
        //"format-icons": {
        //    "Charging": ["󰢟","󰢜","󰂆","󰂇","󰂈","󰢝","󰂉","󰢞","󰂊","󰂋","󰂅"],
        //    "default": ["󱃍","󰁺","󰁻","󰁼","󰁽","󰁾","󰁿","󰂀","󰂁","󰂂","󰁹"]
        //}
        "format-icons": [
            "󱃍",
            "󰁺",
            "󰁻",
            "󰁼",
            "󰁽",
            "󰁾",
            "󰁿",
            "󰂀",
            "󰂁",
            "󰂂",
            "󰁹"
        ]
    },
    "battery#charging": {
        "states": {
            // "good": 95,
            "warning": 30,
            "critical": 15
        },
        "format": "",
        "format-charging": "{icon} {capacity}%",
        // "format-good": "", // An empty format will hide the module
        //"format-icons": {
        //    "Charging": ["󰢟","󰢜","󰂆","󰂇","󰂈","󰢝","󰂉","󰢞","󰂊","󰂋","󰂅"],
        //    "default": ["󱃍","󰁺","󰁻","󰁼","󰁽","󰁾","󰁿","󰂀","󰂁","󰂂","󰁹"]
        //}
        "format-icons": [
            "󰢟",
            "󰢜",
            "󰂆",
            "󰂇",
            "󰂈",
            "󰢝",
            "󰂉",
            "󰢞",
            "󰂊",
            "󰂋",
            "󰂅"
        ]
    },
    // Pulseaudio
    "pulseaudio": {
        // "scroll-step": 1, // %, can be a float
        "format": "{icon} {volume}%",
        "format-bluetooth": "{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"
    },
    // Bluetooth
    "bluetooth": {
        "format": " {status}",
        "format-disabled": "",
        "format-off": "",
        "interval": 30,
        "on-click": "blueman-manager",
        "format-no-controller": ""
    },
    // Other
    "user": {
        "format": "{user}",
        "interval": 60,
        "icon": false,
    },
    // Idle Inhibator
    "idle_inhibitor": {
        "format": "{icon}",
        "tooltip": true,
        "format-icons": {
            "activated": "",
            "deactivated": ""
        },
        "on-click-right": "hyprlock"
    },
    "custom/events": {
        "format": "{}",
        "tooltip": true,
        "interval": 300,
        "format-icons": {
            "default": ""
        },
        "exec": "python3 ~/dotfiles/scripts/waybar-khal.py",
        "return-type": "json",
        "on-click-right": "vdirsyncer sync"
    },
    "group/time": {
        "orientation": "inherit",
        "drawer": {
            "transition-duration": 300,
            "children-class": "not-memory",
            "transition-left-to-right": false
        },
        "modules": [
            "clock",
            "custom/events"
        ]
    }
}
