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

let
  cfg = config.samfelag.modules.app.spotify;
  i3Cfg = config.samfelag.modules.desktop.wm.i3;
  hyprCfg = config.samfelag.modules.desktop.wm.hyprland;
in
{
  options.samfelag.modules.app.spotify = {
    enable = lib.mkEnableOption "spotify";
  };
  config = lib.mkIf cfg.enable {
    hm.home.packages = with pkgs; [
      spotify
    ];

    samfelag.modules.desktop.wm.i3.extraKeybindings = lib.mkIf i3Cfg.enable {
      "${i3Cfg.mod}+Shift+m" =  "exec ${pkgs.spotify}/bin/spotify";
    };

    samfelag.modules.desktop.wm.hyprland.extraKeybindings = lib.mkIf hyprCfg.enable [
      "${hyprCfg.mod} SHIFT, m, exec, ${pkgs.spotify}/bin/spotify"
    ];
  };
}
