From d91bbd3eee50426d05a6644ea5fbdc4580138a46 Mon Sep 17 00:00:00 2001 From: Alexis Hovorka Date: Sun, 4 Jul 2021 14:44:38 -0600 Subject: [refactor] Rename tmux/status-left to tmux/status --- base/tmux.conf | 25 +++++++++++++++++++++++-- base/tmux/status | 35 +++++++++++++++++++++++++++++++++++ base/tmux/status-left | 35 ----------------------------------- 3 files changed, 58 insertions(+), 37 deletions(-) create mode 100755 base/tmux/status delete mode 100755 base/tmux/status-left diff --git a/base/tmux.conf b/base/tmux.conf index 94f28a1..272c954 100644 --- a/base/tmux.conf +++ b/base/tmux.conf @@ -23,7 +23,7 @@ set -g status-position top set -g status-left-length 50 set -g status-right-length 30 set -g status-style "fg=colour8,bg=colour18" -set -g status-left "#(bash ~/.tmux/status-left)" +set -g status-left "#(bash ~/.tmux/status)" set -g status-right "#[fg=colour19]#[bg=colour19,fg=colour7] %a %m.%d %R 💜" set -g window-status-format "#{?#W,#W,#I} #[default,fg=colour19]" set -g window-status-current-format "#{?#W,#W,#I} #[nobold,fg=colour19]" @@ -76,6 +76,7 @@ bind -r C-h resizep -L bind -r C-j resizep -D bind -r C-k resizep -U bind -r C-l resizep -R +# TODO Create new window instead of cycling? unbind % unbind "'" @@ -87,7 +88,27 @@ bind Tab last # most recent window bind -r "<" swapw -d -t -1 bind -r ">" swapw -d -t +1 -bind T run "bash ~/.tmux/status-left toggle-task" +bind T run "bash ~/.tmux/status toggle-task" + +#bind -T root F12 \ +# set prefix None \;\ +# set key-table off \;\ +# set status-style "fg=$color_status_text,bg=$color_window_off_status_bg" \;\ +# set window-status-current-format "#[fg=$color_window_off_status_bg,bg=$color_window_off_status_current_bg]$separator_powerline_right#[default] #I:#W# #[fg=$color_window_off_status_current_bg,bg=$color_window_off_status_bg]$separator_powerline_right#[default]" \;\ +# set window-status-current-style "fg=$color_dark,bold,bg=$color_window_off_status_current_bg" \;\ +# if -F '#{pane_in_mode}' 'send-keys -X cancel' \;\ +# refresh-client -S \;\ +# +#bind -T off F12 \ +# set -u prefix \;\ +# set -u key-table \;\ +# set -u status-style \;\ +# set -u window-status-current-style \;\ +# set -u window-status-current-format \;\ +# refresh-client -S +# +#wg_is_keys_off="#[fg=$color_light,bg=$color_window_off_indicator]#([ $(tmux show-option -qv key-table) = 'off' ] && echo 'OFF')#[default]" +#set -g status-right "$wg_is_keys_off #{sysstat_cpu} | #{sysstat_mem} | #{sysstat_loadavg} | $wg_user_host" bind r source ~/.tmux.conf diff --git a/base/tmux/status b/base/tmux/status new file mode 100755 index 0000000..bb2ad9e --- /dev/null +++ b/base/tmux/status @@ -0,0 +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" diff --git a/base/tmux/status-left b/base/tmux/status-left deleted file mode 100755 index bb2ad9e..0000000 --- a/base/tmux/status-left +++ /dev/null @@ -1,35 +0,0 @@ -#!/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" -- cgit v1.2.3-54-g00ecf