From fd9177b6cc728115999fb78e1266108210b2cb6d Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Tue, 20 May 2025 21:22:09 +0200 Subject: modules/{i3bar-river,i3status-rust}: Init --- .../i3/i3status-rust/scripts/mpd_song_name.sh | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 modules/by-name/i3/i3status-rust/scripts/mpd_song_name.sh (limited to 'modules/by-name/i3/i3status-rust/scripts') 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 +# 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 . + +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 -- cgit 1.4.1