diff options
Diffstat (limited to 'modules/by-name/i3/i3status-rust/scripts/mpd_song_name.sh')
-rwxr-xr-x | modules/by-name/i3/i3status-rust/scripts/mpd_song_name.sh | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/modules/by-name/i3/i3status-rust/scripts/mpd_song_name.sh b/modules/by-name/i3/i3status-rust/scripts/mpd_song_name.sh new file mode 100755 index 00000000..28921520 --- /dev/null +++ b/modules/by-name/i3/i3status-rust/scripts/mpd_song_name.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env dash + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +while true; do + state="$(mpc status '%state%')" + + if [ "$state" = "playing" ]; then + song="$(mpc --format '[[%artist% - ]%title%]|[%file%]' current)" + progress="$(mpc status "%currenttime%/%totaltime%")" + + echo "$song :: $progress" + else + # The song has stopped, we are done displaying it. + echo "" + + # Wait for a new song. (Or in this case for a new event.) + mpc idle + fi + + sleep 1 +done + +# vim: ft=sh |