Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable time and date visibility #75

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions nord.tmux
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ NORD_TMUX_STATUS_CONTENT_NO_PATCHED_FONT_FILE="src/nord-status-content-no-patche
NORD_TMUX_STATUS_CONTENT_OPTION="@nord_tmux_show_status_content"
NORD_TMUX_STATUS_CONTENT_DATE_FORMAT="@nord_tmux_date_format"
NORD_TMUX_NO_PATCHED_FONT_OPTION="@nord_tmux_no_patched_font"
NORD_TMUX_SHOW_DATE="@nord_tmux_show_date"
NORD_TMUX_SHOW_TIME="@nord_tmux_show_time"
_current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

__cleanup() {
unset -v NORD_TMUX_COLOR_THEME_FILE NORD_TMUX_VERSION
unset -v NORD_TMUX_STATUS_CONTENT_FILE NORD_TMUX_STATUS_CONTENT_NO_PATCHED_FONT_FILE
unset -v NORD_TMUX_STATUS_CONTENT_OPTION NORD_TMUX_NO_PATCHED_FONT_OPTION
unset -v NORD_TMUX_STATUS_CONTENT_DATE_FORMAT
unset -v NORD_TMUX_SHOW_DATE NORD_TMUX_SHOW_TIME
unset -v _current_dir
unset -f __load __cleanup
tmux set-environment -gu NORD_TMUX_STATUS_TIME_FORMAT
Expand All @@ -34,18 +37,18 @@ __load() {
local status_content=$(tmux show-option -gqv "$NORD_TMUX_STATUS_CONTENT_OPTION")
local no_patched_font=$(tmux show-option -gqv "$NORD_TMUX_NO_PATCHED_FONT_OPTION")
local date_format=$(tmux show-option -gqv "$NORD_TMUX_STATUS_CONTENT_DATE_FORMAT")
local show_date=$(tmux show-option -gqv "$NORD_TMUX_SHOW_DATE")
local show_time=$(tmux show-option -gqv "$NORD_TMUX_SHOW_TIME")

if [ "$(tmux show-option -gqv "clock-mode-style")" == '12' ]; then
tmux set-environment -g NORD_TMUX_STATUS_TIME_FORMAT "%I:%M %p"
else
tmux set-environment -g NORD_TMUX_STATUS_TIME_FORMAT "%H:%M"
fi

if [ -z "$date_format" ]; then
tmux set-environment -g NORD_TMUX_STATUS_DATE_FORMAT "%Y-%m-%d"
else
tmux set-environment -g NORD_TMUX_STATUS_DATE_FORMAT "$date_format"
fi
tmux set-environment -g NORD_TMUX_STATUS_DATE_FORMAT ${date_format:-%Y-%m-%d}
tmux set-environment -g NORD_TMUX_SHOW_DATE ${show_date:-1}
tmux set-environment -g NORD_TMUX_SHOW_TIME ${show_time:-1}

if [ "$status_content" != "0" ]; then
if [ "$no_patched_font" != "1" ]; then
Expand Down
2 changes: 1 addition & 1 deletion src/nord-status-content-no-patched-font.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ set -g @prefix_highlight_copy_mode_attr "fg=black,bg=brightcyan"
#+--------+
#+--- Bars ---+
set -g status-left "#[fg=black,bg=blue,bold] #S "
set -g status-right "#{prefix_highlight}#[fg=white,bg=brightblack] ${NORD_TMUX_STATUS_DATE_FORMAT} #[fg=white,bg=brightblack,nobold,noitalics,nounderscore]|#[fg=white,bg=brightblack] ${NORD_TMUX_STATUS_TIME_FORMAT} #[fg=cyan,bg=brightblack,nobold,noitalics,nounderscore] #[fg=black,bg=cyan,bold] #H "
set -g status-right "#{prefix_highlight}#{?#{NORD_TMUX_SHOW_DATE},#[fg=white]#[bg=brightblack] ${NORD_TMUX_STATUS_DATE_FORMAT} ,}#{?#{&&:#{NORD_TMUX_SHOW_DATE},#{NORD_TMUX_SHOW_TIME}},#[fg=white]#[bg=brightblack]#[nobold]#[noitalics]#[nounderscore]|,}#{?#{NORD_TMUX_SHOW_TIME},#[fg=white]#[bg=brightblack] ${NORD_TMUX_STATUS_TIME_FORMAT} ,}#[fg=black,bg=cyan,bold] #H "

#+--- Windows ---+
set -g window-status-format " #[fg=white,bg=brightblack]#I #[fg=white,bg=brightblack]#W #F"
Expand Down
2 changes: 1 addition & 1 deletion src/nord-status-content.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set -g @prefix_highlight_copy_mode_attr "fg=brightcyan,bg=black,bold"
#+--------+
#+--- Bars ---+
set -g status-left "#[fg=black,bg=blue,bold] #S #[fg=blue,bg=black,nobold,noitalics,nounderscore]"
set -g status-right "#{prefix_highlight}#[fg=brightblack,bg=black,nobold,noitalics,nounderscore]#[fg=white,bg=brightblack] ${NORD_TMUX_STATUS_DATE_FORMAT} #[fg=white,bg=brightblack,nobold,noitalics,nounderscore]#[fg=white,bg=brightblack] ${NORD_TMUX_STATUS_TIME_FORMAT} #[fg=cyan,bg=brightblack,nobold,noitalics,nounderscore]#[fg=black,bg=cyan,bold] #H "
set -g status-right "#{prefix_highlight}#{?#{||:#{NORD_TMUX_SHOW_DATE},#{NORD_TMUX_SHOW_TIME}},#[fg=brightblack]#[bg=black]#[nobold]#[noitalics]#[nounderscore],}#{?#{NORD_TMUX_SHOW_DATE},#[fg=white]#[bg=brightblack] ${NORD_TMUX_STATUS_DATE_FORMAT} ,}#[fg=#{?#{NORD_TMUX_SHOW_DATE},white,brightblack},bg=#{?NORD_TMUX_SHOW_DATE,brightblack,black},nobold,noitalics,nounderscore]#{?#{&&:#{NORD_TMUX_SHOW_DATE},#{NORD_TMUX_SHOW_TIME}},,}#{?#{NORD_TMUX_SHOW_TIME},#[fg=white]#[bg=brightblack] ${NORD_TMUX_STATUS_TIME_FORMAT} ,}#[fg=cyan,bg=#{?#{||:#{NORD_TMUX_SHOW_DATE},#{NORD_TMUX_SHOW_TIME}},brightblack,default},nobold,noitalics,nounderscore]#[fg=black,bg=cyan,bold] #H "

#+--- Windows ---+
set -g window-status-format "#[fg=black,bg=brightblack,nobold,noitalics,nounderscore] #[fg=white,bg=brightblack]#I #[fg=white,bg=brightblack,nobold,noitalics,nounderscore] #[fg=white,bg=brightblack]#W #F #[fg=brightblack,bg=black,nobold,noitalics,nounderscore]"
Expand Down