mirror of
https://github.com/donovanglover/nix-config.git
synced 2025-02-19 03:01:27 +01:00
meta: Replace ncmpcpp song change script with mpdris2-rs
This greatly simplifies the config and enables the usage of song change notifications outside of ncmpcpp.
This commit is contained in:
parent
7ae7af253c
commit
8fb63f0712
@ -76,6 +76,7 @@ in
|
|||||||
"wpctl set-volume @DEFAULT_AUDIO_SINK@ 20%"
|
"wpctl set-volume @DEFAULT_AUDIO_SINK@ 20%"
|
||||||
"ironbar"
|
"ironbar"
|
||||||
"fcitx5"
|
"fcitx5"
|
||||||
|
"mpdris2-rs"
|
||||||
"hyprctl dispatch workspace 5000000"
|
"hyprctl dispatch workspace 5000000"
|
||||||
"${polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"
|
"${polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"
|
||||||
"hyprdim --no-dim-when-only --persist --ignore-leaving-special --dialog-dim"
|
"hyprdim --no-dim-when-only --persist --ignore-leaving-special --dialog-dim"
|
||||||
|
@ -5,8 +5,6 @@ let
|
|||||||
inherit (config.xdg.userDirs) music;
|
inherit (config.xdg.userDirs) music;
|
||||||
|
|
||||||
musicDirectory = music;
|
musicDirectory = music;
|
||||||
changeScript = "ncmpcpp/on-song-change.sh";
|
|
||||||
fallbackImage = ../assets/wallpaper.png;
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
home.packages = [ mpc-cli ];
|
home.packages = [ mpc-cli ];
|
||||||
@ -20,32 +18,6 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
xdg.configFile.${changeScript} = {
|
|
||||||
executable = true;
|
|
||||||
text = /* bash */ ''
|
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
find_cover () {
|
|
||||||
ext="$(mpc --format %file% current | sed 's/^.*\.//')"
|
|
||||||
|
|
||||||
if [ "$ext" == "flac" ]; then
|
|
||||||
metaflac --export-picture-to=/tmp/cover.jpg \
|
|
||||||
"$(mpc --format "${musicDirectory}"/%file% current)" && cover_path="/tmp/cover.jpg" && return
|
|
||||||
else
|
|
||||||
ffmpeg -y -i "$(mpc --format "${musicDirectory}"/%file% | head -n 1)" \
|
|
||||||
/tmp/cover.jpg && cover_path="/tmp/cover.jpg" && return
|
|
||||||
fi
|
|
||||||
|
|
||||||
file="${musicDirectory}/$(mpc --format %file% current)"
|
|
||||||
album="''${file%/*}"
|
|
||||||
cover_path=$(find "$album" -maxdepth 1 | grep -m 1 ".*\.\(jpg\|png\|gif\|bmp\)")
|
|
||||||
}
|
|
||||||
|
|
||||||
find_cover 2>/dev/null
|
|
||||||
notify-send -i "''${cover_path:-${fallbackImage}}" "Now Playing" "$(mpc current)" 2>/dev/null
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
programs.ncmpcpp = {
|
programs.ncmpcpp = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
@ -86,7 +58,6 @@ in
|
|||||||
autocenter_mode = "yes";
|
autocenter_mode = "yes";
|
||||||
allow_for_physical_item_deletion = "no";
|
allow_for_physical_item_deletion = "no";
|
||||||
mouse_support = "no";
|
mouse_support = "no";
|
||||||
execute_on_song_change = "~/.config/${changeScript}";
|
|
||||||
mpd_crossfade_time = 3;
|
mpd_crossfade_time = 3;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user