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

let
  cfg = config.cspark-desktop-sway-config-1;
in
{
  options.cspark-desktop-sway-config-1 = {
    enable 
      = lib.mkEnableOption "Enable Custom Sway Desktop Setup 1";
  };

  config = lib.mkIf cfg.enable {
    # Config Files (typically $HOME/.config)
    xdg.configFile = {
      "sway/config".source = ./resources/home-manager/.config/sway/config;
      "mako/config".source = ./resources/home-manager/.config/mako/config;
      "foot/foot.ini".source = ./resources/home-manager/.config/foot/foot.ini;
      "networkmanager-dmenu/config.ini".source = ./resources/home-manager/.config/networkmanager-dmenu/config.ini;
    };

    services.udiskie.enable = true;
    services.udiskie.tray = "never";

    home.sessionVariables = {
      TERM = "foot";
      QT_QPA_PLATFORM = "wayland";
      QT_QPA_PLATFORMTHEME = "qt6ct";
      QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
      SDL_VIDEODRIVER = "wayland,x11,windows";
      _JAVA_AWT_WM_NONREPARENTING = "1";
      SSH_ASKPASS = "lxqt-openssh-askpass";
      # Enable native wayland support for chromium and electron based applications
      NIXOS_OZONE_WL = "1";
    };

    # Start sway after login if on TTY1 (Default Linux TTY upon boot/login)
    programs.bash.profileExtra = ''
                     if [[ $(tty) == "/dev/tty1" ]]; then
                                       sway
                     fi
                     '';
  };
}
