{ config, lib, pkgs, ... }:

{
  config = {
    home-manager.users.jade = { pkgs, ... }: {
      #xsession.windowManager.i3.config.startup = [
        #{ 
          #command = "pkill polybar; polybar"; 
          #always = true; 
        #}
      #];
      services.polybar = {
        enable = true;
        package = pkgs.polybarFull;

        script = "";
        settings = {
          colors = {
            background = "#282828";
            background-alt = "#3c3836";
            foreground = "#ebdbb2";
            primary = "#d65d0e";
            secondary = "#fe8019";
            alert = "#cc241d";
            disabled = "#504945";
          };
          "bar/status" = {
            # Style
            width = "100%";
            height = "24px";
            radius = 0;
            tray-position = "center";
            background = "\${colors.background}";
            foreground = "\${colors.foreground}";
            line-size = "4px";
            border-color = "#00000000";
            padding-left = 0;
            padding-right = 1;
            module-margin = 1;
            separator = "|";
            separator-foreground = "\${colors.disabled}";
            font-0 = "FiraCode Nerd Font";
            modules-left = "xworkspaces xwindow";
            modules-right = "memory cpu wlan battery date";
            cursor-click = "pointer";
            cursor-scroll = "ns-resize";
            enable-ipc = true;
            wm-restack = "generic";
            override-redirect = false;
          };

          "module/xworkspaces" = {
            type = "internal/xworkspaces";
            label-active = "";
            label-active-padding = 1;
            label-occupied = "";
            label-occupied-padding = 1;
            label-urgent = "";
            label-urgent-foreground = "\${colors.alert}";
            label-urgent-padding = 1;
            label-empty = "";
            label-empty-foreground = "\${colors.disabled}";
            label-empty-padding = 1;
          };

          "module/xwindow" = {
            type = "internal/xwindow";
            label = "%title:0:60:...%";
          };

          "module/memory" = {
            type = "internal/memory";
            interval = 2;
            format-prefix = "󰍛 ";
            format-prefix-foreground = "\${colors.primary}";
            label = "%percentage_used:2%%";
          };

          "module/cpu" = {
            type = "internal/cpu";
            interval = "2";
            format-prefix = " ";
            format-prefix-foreground = "\${colors.primary}";
            label = "%percentage:2%%";
          };

          "network-base" = {
            type = "internal/network";
            interval = 5;
            format-connected = "<label-connected>";
            format-disconnected = "<label-disconnected>";
            label-disconnected = "%{F#F0C674}%ifname%%{F#707880} disconnected";
          };

          "module/wlan" = {
            "inherit" = "network-base";
            interface-type = "wireless";
            label-connected = "%{F#F0C674}%ifname%%{F-} %essid% %local_ip%";
          };

          "module/battery" = {
            type = "internal/battery";
            poll-interval = 1;
            full-at = 96;
            battery = "BAT0";
            adapter = "ADP1";
            time-format = "%H:%M";
            label-charging = "%percentage%% %time%";
            format-charging = "<ramp-capacity> 󰚥 <label-charging>";
            label-discharging = "%percentage%% %time%";
            format-discharging = "<ramp-capacity> <label-discharging>";
            label-full = "%percentage%%";
            format-full = "󰁹 <label-full>";
            label-low = "%percentage%%";
            format-low = "󰂎 <label-low>";
            ramp.capacity = [ "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹" ];
          };

          "module/date" = {
            type = "internal/date";
            interval = 1;
            date = "%Y-%m-%d %H:%M:%S";
            label = "%date%";
            label-foreground = "\${colors.foreground}";
          };

          "settings" = {
            screenchange-reload = true;
            pseudo-transparency = true;
          };
        };
      };
    };
  };
}
