summaryrefslogtreecommitdiffstats
path: root/scripts/scrolling-title.nix
diff options
context:
space:
mode:
authorSkullheadx <admonty1@protonmail.com>2026-04-29 17:33:13 -0400
committerSkullheadx <admonty1@protonmail.com>2026-04-29 17:33:13 -0400
commit63dacf13def241461cdbadde012751d62551cb31 (patch)
tree81c86fccc831ce1aa922ac5fe225c2e649e520d9 /scripts/scrolling-title.nix
parentupdate dwm (diff)
downloadnixos-63dacf13def241461cdbadde012751d62551cb31.tar.gz
nixos-63dacf13def241461cdbadde012751d62551cb31.tar.bz2
nixos-63dacf13def241461cdbadde012751d62551cb31.zip
scripts dir
Diffstat (limited to '')
-rw-r--r--scripts/scrolling-title.nix24
1 files changed, 24 insertions, 0 deletions
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))"'';
+}