all repos — dotfiles @ c089edee95776be85a5f3004b148a13603aef383

my *nix dotfiles

Add now playing script
Anirudh Oppiliappan x@icyphox.sh
Tue, 24 Nov 2020 19:10:46 +0530
commit

c089edee95776be85a5f3004b148a13603aef383

parent

16123e04720719f3605afc6cbeb699af1a061889

3 files changed, 34 insertions(+), 1 deletions(-)

jump to
A config/fish/functions/f.fish

@@ -0,0 +1,6 @@

+# Defined in /tmp/fish.SD03YE/f.fish @ line 2 +function f + fff $argv + set -q XDG_CACHE_HOME; or set XDG_CACHE_HOME $HOME/.cache + cd (cat $XDG_CACHE_HOME/fff/.fff_d) +end
M home/.tmux.confhome/.tmux.conf

@@ -77,6 +77,7 @@

set -g status-left-length 100 set -g status-left "#[fg=colour8]time #[fg=colour15]#(date +"%H:%M") " set -ag status-left "#[fg=colour8]date #[fg=colour15]#(date.sh) " -set -ag status-left "#[fg=colour8]bat #[fg=colour15]#(~/bin/bat -q)" +set -ag status-left "#[fg=colour8]bat #[fg=colour15]#(~/bin/bat -q) " +set -ag status-left "#[fg=colour8]#(~/bin/np.sh -a) #[fg=colour15]#(~/bin/np.sh -t)" run-shell ~/leet/tmux-resurrect/resurrect.tmux
A home/bin/np.sh

@@ -0,0 +1,26 @@

+#!/usr/bin/env bash + +stripnl() { + printf '%s' "${1##"\n"}" +} + +check_playing() { + status="$(cmus-remote -Q | grep status | cut -d ' ' -f 2)" + [[ "$status" == "paused" ]] && exit +} + +check_playing +mapfile np < <(cmus-remote -Q | grep tag | head -n3 | sort -r | cut -d ' ' -f 3-) +track="$(stripnl "${np[0]}")" +artist="$(stripnl "${np[1]}")" + +case "$1" in + "-a") + printf '%s' "$artist" + ;; + "-t") + printf '%s' "$track" + ;; + *) + printf '%s - %s\n' "$artist" "$track" +esac