{
  "layer": "top",
  "position": "top",
  "mode": "dock",
  "reload_style_on_change": true,
  "gtk-layer-shell": true,

  // === Positions ===

  "modules-left": [
    "hyprland/workspaces",
    "clock",
    "cava"
  ],

  "modules-center": [
    "hyprland/window"
  ],

  "modules-right": [
    "custom/media",
    "tray",
    "custom/wifi",
    "bluetooth",
    "pulseaudio",
    "battery",
    "custom/power"
  ],

  // === Modules ===

  "tray": {
    "icon-size": 12,
    "spacing": 4
  },

  "hyprland/workspaces": {
    "on-scroll-up": "hyprctl dispatch workspace -1",
    "on-scroll-down": "hyprctl dispatch workspace +1",
    "persistent-workspaces": {
      "1": [],
      "2": [],
      "3": [],
      "4": [],
      "5": []
    }
  },

  "hyprland/window": {
    "format": "{}",
    "min-length": 5,

    // === Window Titles ===

    "rewrite": {
      // == Desktop ==

      "": 
        "<span foreground='#89b4fa'> </span> Hyprland",

      // == Terminal ==

      "~": "  Terminal",
      "zsh": "  Terminal",
      "kitty": "  Terminal",
      "sejjy@archlinux:(.*)": "  Terminal",
      "(.*)sejjy@archlinux:~": "  Terminal",

      // == Browser ==

      "(.*)Mozilla Firefox": 
        "<span foreground='#f38ba8'>󰈹 </span> Firefox",
      "(.*) — Mozilla Firefox": 
        "<span foreground='#f38ba8'>󰈹 </span> $1",

      "(.*)Zen Browser": 
        "<span foreground='#cdd6f4'>󰈹 </span> Zen Browser",
      "(.*) — Zen Browser": 
        "<span foreground='#cdd6f4'>󰈹 </span> $1",

      // == Development ==

      "(.*) - Visual Studio Code": 
        "<span foreground='#89b4fa'>󰨞 </span> $1",
      "(.*)Visual Studio Code": 
        "<span foreground='#89b4fa'>󰨞 </span> Visual Studio Code",

      "nvim": 
        "<span foreground='#a6e3a1'> </span> Neovim",
      "nvim (.*)": 
        "<span foreground='#a6e3a1'> </span> $1",

      "vim": 
        "<span foreground='#a6e3a1'> </span> Vim",
      "vim (.*)": 
        "<span foreground='#a6e3a1'> </span> $1",

      "Godot": 
        "<span foreground='#89b4fa'> </span> Godot Engine",
      "Godot Engine - (.*)": 
        "<span foreground='#89b4fa'> </span> $1",
      "(.*) - Godot Engine": 
        "<span foreground='#89b4fa'> </span> $1",

      // == Media ==

      "(.*)Spotify": 
        "<span foreground='#a6e3a1'> </span> Spotify",
      "(.*)Spotify Premium": 
        "<span foreground='#a6e3a1'> </span> Spotify Premium",

      "OBS(.*)": 
        "<span foreground='#a6adc8'>󰐌 </span> OBS Studio",

      "VLC media player": 
        "<span foreground='#fab387'>󰕼 </span> VLC Media Player",
      "(.*) - VLC media player": 
        "<span foreground='#fab387'>󰕼 </span> $1",

      "(.*) - mpv": 
        "<span foreground='#cba6f7'> </span> $1",

      "GNU Image Manipulation Program": 
        "<span foreground='#a6adc8'> </span> GNU Image Manipulation Program",

      "qView": "  qView",

      "(.*).jpg": "  $1.jpg",
      "(.*).png": "  $1.png",
      "(.*).svg": "  $1.svg",

      // == Social ==

      "vesktop": 
        "<span foreground='#89b4fa'> </span> Discord",

      "• Discord(.*)": "Discord$1",
      "(.*)Discord(.*)": 
        "<span foreground='#89b4fa'> </span> $1Discord$2",

      // == Documents ==

      "ONLYOFFICE Desktop Editors": 
        "<span foreground='#f38ba8'> </span> OnlyOffice Desktop",

      "(.*).docx": 
        "<span foreground='#89b4fa'> </span> $1.docx",
      "(.*).xlsx": 
        "<span foreground='#a6e3a1'> </span> $1.xlsx",
      "(.*).pptx": 
        "<span foreground='#fab387'> </span> $1.pptx",
      "(.*).pdf": 
        "<span foreground='#f38ba8'> </span> $1.pdf",

      "/": "  File Manager",

      // == System ==

      "Timeshift-gtk": 
        "<span foreground='#a6e3a1'> </span> Timeshift",

      "Authenticate": "  Authenticate"
    }
  },

  "clock": {
    "format": "{:%m-%d %H:%M}",
    "tooltip-format": "<tt>{calendar}</tt>",

    "calendar": {
      "mode": "month",
      "mode-mon-col": 6,
      "on-click-right": "mode",

      "format": {
        "months": 
          "<span color='#b4befe'><b>{}</b></span>",
        "weekdays": 
          "<span color='#a6adc8' font='7'>{}</span>",
        "today": 
          "<span color='#f38ba8'><b>{}</b></span>"
      }
    },

    "actions": {
      "on-click": "mode",
      "on-click-right": "mode"
    }
  },

  "custom/wifi": {
    "exec": "~/.config/waybar/scripts/wifi-status.sh",
    "return-type": "json",
    "format": "{}",
    "tooltip": true,
    "on-click": "~/.config/waybar/scripts/wifi-menu.sh",
    "on-click-right": "kitty --title '󰤨 Network Manager TUI' bash -c nmtui",
    "interval": 1,
    "min-length": 1,
    "max-length": 1
  },

  "bluetooth": {
    "format": "󰂰",
    "format-disabled": "󰂲",
    "format-connected": "󰂱",
    "format-connected-battery": "󰂱",

    "tooltip-format": 
      "{num_connections} connected",
    "tooltip-format-disabled": 
      "Bluetooth Disabled",
    "tooltip-format-connected": 
      "{num_connections} connected\n{device_enumerate}",
    "tooltip-format-enumerate-connected": 
      "{device_alias}",
    "tooltip-format-enumerate-connected-battery": 
      "{device_alias}: {device_battery_percentage}%",

    "on-click": "~/.config/waybar/scripts/bluetooth-menu.sh",
    "on-click-right": "kitty --title '󰂯  Bluetooth TUI' bash -c bluetui",
    "interval": 1,
    "min-length": 1,
    "max-length": 1
  },

  "custom/media": {
    "exec": "~/.config/waybar/scripts/media-player.py",
    "return-type": "json",
    "format": "{}",
    "tooltip": "{tooltip}",
    "on-click": "playerctl play-pause",
    "min-length": 5,
    "max-length": 45
  },

  "pulseaudio": {
    "format": "{icon} {volume}%",
    "format-muted": "󰝟 {volume}%",

    "format-icons": {
      "default": ["󰕿", "󰖀", "󰕾"],
      "headphone": "󰋋",
      "headset": "󰋋"
    },

    "tooltip": true,
    "tooltip-format": "Device: {desc}",
    "on-click": "~/.config/waybar/scripts/volume-control.sh -o m",
    "on-scroll-up": "~/.config/waybar/scripts/volume-control.sh -o i",
    "on-scroll-down": "~/.config/waybar/scripts/volume-control.sh -o d",
    "min-length": 6,
    "max-length": 6
  },

  "battery": {
    "states": {
      "warning": 30,
      "critical": 15
    },

    "format": "{icon} {capacity}%",
    "format-icons": ["󰁼", "󰁽", "󰁾", "󰁿", "󰂀", "󰂁", "󰂂"],
    "format-warning": "󰁻 {capacity}%",
    "format-critical": "󱃍 {capacity}%",
    "format-charging": "󱘖 {capacity}%",

    "tooltip-format": "Discharging: {time}",
    "tooltip-format-charging": "Charging: {time}",
    "interval": 1,
    "min-length": 6,
    "max-length": 6
  },

  "custom/power": {
    "format": " ",
    "tooltip": true,
    "tooltip-format": "Power Menu",
    "on-click": "~/.config/waybar/scripts/power-menu.sh"
  },

  "cava": {
        //"cava_config": "$XDG_CONFIG_HOME/cava/cava.conf",
        "framerate": 60,
        "autosens": 1,
        //"sensitivity": 10,
        "bars": 25,
        "lower_cutoff_freq": 20,
        "higher_cutoff_freq": 20000,
        "method": "pulse",
        "source": "auto",
        "stereo": true,
        "reverse": false,
        "bar_delimiter": 0,
        "monstercat": false,
        "waves": false,
        "noise_reduction": 0.2,
        "input_delay": 1,
        "format-icons" : ["▁", "▂", "▃", "▄", "▅", "▆", "▇", "█" ]
    }
}
