From 63dacf13def241461cdbadde012751d62551cb31 Mon Sep 17 00:00:00 2001 From: Skullheadx Date: Wed, 29 Apr 2026 17:33:13 -0400 Subject: scripts dir --- scripts/scrolling-title.nix | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 scripts/scrolling-title.nix (limited to 'scripts/scrolling-title.nix') diff --git a/scripts/scrolling-title.nix b/scripts/scrolling-title.nix new file mode 100644 index 0000000..0bafa1b --- /dev/null +++ b/scripts/scrolling-title.nix @@ -0,0 +1,24 @@ +{ pkgs }: +pkgs.writeShellApplication { + name = "scrolling-title"; + runtimeInputs = with pkgs; [ mpc coreutils ]; + text = '' + WIDTH=16 + PADDING=" " + + RAW_STR=$(mpc current) + + if [ -z "$RAW_STR" ]; then + echo "Stopped" + exit 0 + fi + + STR="$RAW_STR$PADDING" + LEN=''${#STR} + + T=$(date +%s) + INDEX=$(( T % LEN )) + + # Output the scrolled window + echo "$STR$STR" | cut -c "$((INDEX + 1))-$((INDEX + WIDTH))"''; +} -- cgit v1.3.1