2024-08-06 13:41:05 +02:00
|
|
|
{ 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";
|
|
|
|
};
|
2024-10-16 11:40:24 +02:00
|
|
|
|
2024-08-06 13:41:05 +02:00
|
|
|
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
|
2024-10-16 11:40:24 +02:00
|
|
|
# todo: dmenu for this if i3
|
2024-08-06 13:41:05 +02:00
|
|
|
(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
|
|
|
|
'')
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|