diff options
author | Alexis Hovorka <[email protected]> | 2021-07-04 12:05:10 -0600 |
---|---|---|
committer | Alexis Hovorka <[email protected]> | 2021-07-04 12:05:10 -0600 |
commit | c6bfd0b8f133f96d61c4d2f3b7726777e147bcf4 (patch) | |
tree | 8b06f5854ecfa0c63b8205bb85f8764afb33cc86 /base/tmux/status-left | |
parent | e5b1ed73e39ce57ffc3896bf71181d25c28723bc (diff) |
[feat] Add toggleable task viewer in tmux status
Diffstat (limited to 'base/tmux/status-left')
-rwxr-xr-x | base/tmux/status-left | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/base/tmux/status-left b/base/tmux/status-left index da73711..bb2ad9e 100755 --- a/base/tmux/status-left +++ b/base/tmux/status-left @@ -1,7 +1,35 @@ #!/bin/bash +if [[ "$1" = "toggle-task" ]]; then + if tmux showenv TMUX_SHOW_TASK &>/dev/null; then + tmux setenv -u TMUX_SHOW_TASK + else + tmux setenv TMUX_SHOW_TASK 1 + fi +fi + STATUS="#[bg=colour$HOST_COLOR]#[fg=black] $SHORT_HOSTNAME" if [[ `tmux ls | wc -l` -gt 1 ]]; then STATUS="$STATUS #S"; fi STATUS="$STATUS #[fg=colour$HOST_COLOR]#[bg=colour18] #(bash $0)" tmux set -g status-left "$STATUS" #█ ^Vue0b0 + +if tmux showenv TMUX_SHOW_TASK &>/dev/null; then + TASKCFG="rc.verbose= rc.gc=off rc.color=no" + TASKCOUNT="$(task $TASKCFG +READY count)" + TASKCTX="$(task $TASKCFG _get rc.context | sed "s/.*/\L&/;s/[a-z]*/\u&/g")" + TOPTASK="$(task $TASKCFG rc.report.x.columns=id rc.report.x.filter=+READY \ + rc.report.x.sort=start-,urgency- x | head -n1 | xargs)" + + if [[ "$TASKCTX" ]]; then + TASKCOUNT="#[fg=colour19]#[bg=colour19,fg=colour7] $TASKCTX: $TASKCOUNT #[fg=colour18]#[bg=colour18]#[fg=colour20]" + else + TASKCOUNT="#[fg=colour8]#[fg=colour20] $TASKCOUNT #[fg=colour8]#[fg=colour20]" + fi + + TASKLINE="$TASKCOUNT $TOPTASK. $(task $TASKCFG _get ${TOPTASK}.description) " +else TASKLINE=""; fi + +STATUS="$TASKLINE#[fg=colour19]#[bg=colour19,fg=colour7] %a %m.%d %R 💜" +tmux set -g status-right-length "$(echo "$STATUS" | wc -c)" +tmux set -g status-right "$STATUS" |