{ config, lib, pkgs, osConfig ? null, ... }: let cfg = config.music; spotifyWithWayland = pkgs.symlinkJoin { name = "spotify"; paths = [ pkgs.spotify ]; buildInputs = [ pkgs.makeWrapper ]; postBuild = '' wrapProgram $out/bin/spotify \ --add-flags "--enable-features=UseOzonePlatform --ozone-platform=wayland" ''; }; in { options.music.enable = lib.mkEnableOption "music"; config = lib.mkIf cfg.enable { home.packages = [ spotifyWithWayland ]; programs.ncspot = { enable = true; settings = { backend = lib.mkIf (osConfig.audio.enable or false) (lib.mkDefault "pulseaudio"); default_keybindings = false; flip_status_indicators = true; library_tabs = [ "tracks" "albums" "artists" "playlists" "browse" ]; # remove podcasts tab keybindings = { "Enter" = "play"; " " = "playpause"; "S" = "stop"; "<" = "seek -10000"; ">" = "seek +10000"; "H" = "previous"; "L" = "next"; "r" = "repeat"; "z" = "shuffle"; "d" = "delete"; "s" = "save"; "O" = "open current"; "o" = "open selected"; "Backspace" = "back"; "A" = "goto artist"; "a" = "goto album"; "q" = "queue"; "J" = "shift down 1"; "K" = "shift up 1"; "c" = "clear"; "=" = "volup 1"; "-" = "voldown 1"; "1" = "focus queue"; "2" = "focus search"; "3" = "focus library"; "4" = "focus cover"; "h" = "move left 1"; "j" = "move down 1"; "k" = "move up 1"; "l" = "move right 1"; "g" = "move top"; "G" = "move bottom"; "t" = "sort added d"; "T" = "sort title a"; "y" = "share current"; "Y" = "share selected"; "U" = "update"; notify = "false"; }; }; }; }; }