{ lib, pkgs, config, ...}: let inherit (lib) mkIf mkEnableOption mkOption; cfg = config.chuj.stuff.mpd; user = config.chuj.system.user; in { options.chuj.stuff.mpd = { enable = mkEnableOption "mpd"; }; config = mkIf cfg.enable { home-manager.users.${user} = { services.mpd = { enable = true; extraConfig = '' audio_output { type "pulse" name "PulseAudio Output" } ''; }; home.packages = let yad = "${pkgs.yad}/bin/yad"; dunstify = "${pkgs.dunst}/bin/dunstify"; mpc = "${pkgs.mpc-cli}/bin/mpc"; cut = "${pkgs.coreutils}/bin/cut"; in [ pkgs.mpc-cli # todo: dmenu for this if i3 (pkgs.writeShellScriptBin "mpdfdial.sh" '' path=$(${yad} --file --directory | ${cut} -d "/" -f5-) ${dunstify} "playing from \"$path\"" ${mpc} update ${mpc} rescan ${mpc} add "$path" ${mpc} random on ${mpc} repeat on ${mpc} play '') ]; }; }; }