{
  pkgs,
  inputs,
  common,
  theme,
  lib,
  ...
}:

{
  imports = [ inputs.hyprpanel.homeManagerModules.hyprpanel ];

  programs.hyprpanel = {
    enable = true;
    # Add hyprpanel to the Hyprland config 'exec-once'.
    hyprland.enable = true;
    # Fix the overwrite issue with HyprPanel.
    overwrite.enable = true;

    # Import a theme from './themes/*.json'.
    theme = "";

    # Override the final config with an arbitrary set.
    # Useful for overriding colors in your selected theme.
    # Default: {}
    override = {
      theme.bar.menus.text = "#123ABC";
    };

    # Configure bar layouts for monitors.
    layout = {
      "bar.layouts" = {
        "*" = {
          left = [
            "dashboard"
            "workspaces"
            "windowtitle"
          ];
          middle = [ "media" ];
          right = [
            "kbinput"
            "volume"
            "network"
            "systray"
            "clock"
            "notifications"
          ];
        };
      };
    };

    # Configure and theme almost all options from the GUI.
    # Options that require '{}' or '[]' are not yet implemented,
    # except for the layout above.
    # See 'https://hyprpanel.com/configuration/settings.html'.
    # Default: <same as gui>
    settings = {
      bar = {
        clock.format = "%a %b %d  %H:%M";
        customModules.kbLayout.leftClick = "hyprctl switchxkblayout keychron-keychron-k8-pro next";
        launcher.autoDetectIcon = true;
        network.label = false;
        volume = {
          scrollDown = "${pkgs.hyprpanel}/bin/hyprpanel 'vol -1'";
          scrollUp = "${pkgs.hyprpanel}/bin/hyprpanel 'vol +1'";
        };
        workspaces = {
          show_icons = false;
          show_numbered = true;
        };
      };

      menus = {
        clock = {
          time = {
            military = true;
            hideSeconds = true;
          };
          weather = {
            unit = "metric";
            location = "Bergen, Norway";
            key = common.secret.weatherApiKey lib;
          };
        };

        dashboard = {
          directories.enabled = false;
          powermenu.avatar.image = "${theme.avatar.image}";
          shortcuts.left = {
            shortcut1 = {
              command = common.default.browser;
              icon = ""; # TODO replace with Zen icon
              tooltip = "Zen Browser";
            };
            shortcut2 = {
              command = "spotify";
              icon = "";
              tooltip = "Spotify";
            };
            ## shortcut3 === discord
            ## shortcut4 === rofi -show drun
          };
          stats.enable_gpu = true;
        };
      };

      scalingPriority = "hyprland";

      theme = {
        bar.transparent = true;
        font = {
          name = "${theme.nerdFont} NF";
          size = "16px";
        };
      };

      wallpaper.enable = false;
    };
  };
}
