config/mpd: improve reconfiguration

This commit is contained in:
xeruf 2023-07-27 12:09:17 +02:00
parent f89863d436
commit e46ecf6f3f
2 changed files with 14 additions and 2 deletions

View File

@ -1,5 +1,4 @@
# See man mpd.conf
state_file "~/.local/state/mpd/state"
pid_file "~/.local/state/mpd/mpd.pid"
db_file "~/.local/state/mpd/mpd.db"
@ -20,3 +19,10 @@ auto_update "yes"
restore_paused "yes"
follow_outside_symlinks "yes"
audio_output {
type "pipewire"
name "Pipewire"
command "paplay -f cd 2>/dev/null"
}

View File

@ -23,7 +23,7 @@ touch "$conf_cache"
sel=$(listconf | fzf -1 -0 --tiebreak=end,length --preview '$(test -r {} || echo "sudo") bat --color=always --style=numbers --line-range :200 {}' --query="$1" --history "$conf_cache_dir/searches")
case "$sel" in
("") exit 1;;
("") exit 2;;
(/etc/sudoers) sudo visudo;;
(/etc/fstab) sudoedit "$sel" && sudo findmnt --verify && sudo systemctl daemon-reload;;
#systemctl daemon-reload && mount -af -o remount;;
@ -37,4 +37,10 @@ case "$sel" in
(/etc/nftables.conf) sudoedit "$sel" && sudo systemctl restart nftables;;
(*) edit "$sel";;
esac
case "$sel" in
(*\#\#template) yadm alt;;
esac
case "${sel%\#\#*}" in
(*/mpd.conf) systemctl --user restart mpd;;
esac
echo "$sel" | cat - "$conf_cache" | head -20 >"$conf_tmp" && mv "$conf_tmp" "$conf_cache"