{inputs, pkgs, lib, config, ...}:
let
  cfg = config.nix-config.hypr;
in
{
  options = {
    nix-config.hypr.autostartApps = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default = [
        "gnome-keyring-daemon --start --components=secrets"
        "wl-paste --watch cliphist store"
        "${lib.getExe pkgs.hypridle}"
        # TODO - currently broken
        "${pkgs.owncloud-client}"
        "${lib.getExe pkgs.keepassxc}"
      ];
      description = "List of applications to start automatically in Hyprland.";
    };
  };

  config = {
    wayland.windowManager.hyprland = {
      enable = true;
      systemd.enable = true;
      settings = {
        exec-once = cfg.autostartApps;
      };
    };
  };
}
