Skip to content

Commit c81598d

Browse files
authored
feat: added minimal mode (#123)
2 parents 0e0f27b + 955f6da commit c81598d

File tree

5 files changed

+46
-10
lines changed

5 files changed

+46
-10
lines changed

src/datetime-widget.sh

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
#!/usr/bin/env bash
2+
# Verify if the current session is the minimal session
3+
MINIMAL_SESSION_NAME=$(tmux show-option -gv @tokyo-night-tmux_minimal_session 2>/dev/null)
4+
TMUX_SESSION_NAME=$(tmux display-message -p '#S')
5+
6+
if [ "$MINIMAL_SESSION_NAME" = "$TMUX_SESSION_NAME" ]; then
7+
exit 0
8+
fi
29

310
# Imports
411
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.."
512
. "${ROOT_DIR}/lib/coreutils-compat.sh"
613

714
# Grab global variable for showing datetime widget, only hide if explicitly disabled
815
SHOW_DATETIME=$(tmux show-option -gv @tokyo-night-tmux_show_datetime 2>/dev/null)
16+
"$MINIMAL_SESSION_NAME $TMUX_SESSION_NAME"
17+
c
918
if [[ $SHOW_DATETIME == "0" ]]; then
1019
exit 0
1120
fi
@@ -22,35 +31,38 @@ time_string=""
2231

2332
if [[ $date_format == "YMD" ]]; then
2433
# Year Month Day date format
25-
date_string=" %Y-%m-%d"
34+
date_string="%Y-%m-%d"
2635
elif [[ $date_format == "MDY" ]]; then
2736
# Month Day Year date format
28-
date_string=" %m-%d-%Y"
37+
date_string="%m-%d-%Y"
2938
elif [[ $date_format == "DMY" ]]; then
3039
# Day Month Year date format
31-
date_string=" %d-%m-%Y"
40+
date_string="%d-%m-%Y"
3241
elif [[ $date_format == "hide" ]]; then
3342
# Day Month Year date format
3443
date_string=""
3544
else
3645
# Default to YMD date format if not specified
37-
date_string=" %Y-%m-%d"
46+
date_string="%Y-%m-%d"
3847
fi
3948

4049
if [[ $time_format == "12H" ]]; then
4150
# 12-hour format with AM/PM
42-
time_string="%I:%M %p "
51+
time_string="%I:%M %p"
4352
elif [[ $time_format == "hide" ]]; then
4453
# 24-hour format
4554
time_string=""
4655
else
4756
# Default to 24-hour format if not specified
48-
time_string="%H:%M "
57+
time_string="%H:%M"
4958
fi
5059

5160
separator=""
5261
if [[ $date_string && $time_string ]]; then
5362
separator=""
5463
fi
5564

56-
echo "$RESET#[fg=${THEME[foreground]},bg=${THEME[bblack]}]$date_string $separator$time_string"
65+
date_string="$(date +"$date_string")"
66+
time_string="$(date +"$time_string")"
67+
68+
echo "$RESET#[fg=${THEME[foreground]},bg=${THEME[bblack]}] $date_string $separator$time_string "

src/git-status.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
#!/usr/bin/env bash
2+
# Verify if the current session is the minimal session
3+
MINIMAL_SESSION_NAME=$(tmux show-option -gv @tokyo-night-tmux_minimal_session 2>/dev/null)
4+
TMUX_SESSION_NAME=$(tmux display-message -p '#S')
5+
6+
if [ "$MINIMAL_SESSION_NAME" = $TMUX_SESSION_NAME ]; then
7+
exit 0
8+
fi
29

310
SHOW_NETSPEED=$(tmux show-option -gv @tokyo-night-tmux_show_git)
411
if [ "$SHOW_NETSPEED" == "0" ]; then

src/music-tmux-statusbar.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
#!/usr/bin/env bash
22

3+
# Verify if the current session is the minimal session
4+
MINIMAL_SESSION_NAME=$(tmux show-option -gv @tokyo-night-tmux_minimal_session)
5+
TMUX_SESSION_NAME=$(tmux display-message -p '#S')
6+
7+
if [ "$MINIMAL_SESSION_NAME" = $TMUX_SESSION_NAME ]; then
8+
exit 0
9+
fi
10+
311
# Imports
412
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.."
513
. "${ROOT_DIR}/lib/coreutils-compat.sh"
@@ -28,12 +36,12 @@ fi
2836

2937
# playerctl
3038
if command -v playerctl >/dev/null; then
31-
PLAYER_STATUS=$(playerctl -a metadata --format "{{status}};{{mpris:length}};{{position}};{{title}}" | grep -m1 "Playing")
39+
PLAYER_STATUS=$(playerctl -a metadata --format "{{status}};{{mpris:length}};{{position}};{{title}};{{playerName}}" | grep -m1 "Playing")
3240
STATUS="playing"
3341

3442
# There is no playing media, check for paused media
3543
if [ -z "$PLAYER_STATUS" ]; then
36-
PLAYER_STATUS=$(playerctl -a metadata --format "{{status}};{{mpris:length}};{{position}};{{title}}" | grep -m1 "Paused")
44+
PLAYER_STATUS=$(playerctl -a metadata --format "{{status}};{{mpris:length}};{{position}};{{title}};{{playerName}}" | grep -m1 "Paused")
3745
STATUS="paused"
3846
fi
3947

src/wb-git-status.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
#!/usr/bin/env bash
2+
# Verify if the current session is the minimal session
3+
MINIMAL_SESSION_NAME=$(tmux show-option -gv @tokyo-night-tmux_minimal_session)
4+
TMUX_SESSION_NAME=$(tmux display-message -p '#S')
5+
6+
if [ "$MINIMAL_SESSION_NAME" = "$TMUX_SESSION_NAME" ]; then
7+
exit 0
8+
fi
9+
210
SHOW_WIDGET=$(tmux show-option -gv @tokyo-night-tmux_show_wbg)
311
if [ "$SHOW_WIDGET" == "0" ]; then
412
exit 0

tokyo-night.tmux

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ tmux set -g pane-active-border-style "fg=${THEME[blue]}"
2727
tmux set -g pane-border-status off
2828

2929
tmux set -g status-style bg="${THEME[background]}"
30+
tmux set -g popup-border-style "fg=${THEME[blue]}"
3031

3132
TMUX_VARS="$(tmux show -g)"
3233

@@ -60,7 +61,7 @@ wb_git_status="#($SCRIPTS_PATH/wb-git-status.sh #{pane_current_path} &)"
6061
window_number="#($SCRIPTS_PATH/custom-number.sh #I $window_id_style)"
6162
custom_pane="#($SCRIPTS_PATH/custom-number.sh #P $pane_id_style)"
6263
zoom_number="#($SCRIPTS_PATH/custom-number.sh #P $zoom_id_style)"
63-
date_and_time="$($SCRIPTS_PATH/datetime-widget.sh)"
64+
date_and_time="#($SCRIPTS_PATH/datetime-widget.sh)"
6465
current_path="#($SCRIPTS_PATH/path-widget.sh #{pane_current_path})"
6566
battery_status="#($SCRIPTS_PATH/battery-widget.sh)"
6667
hostname="#($SCRIPTS_PATH/hostname-widget.sh)"

0 commit comments

Comments
 (0)