Skip to content

Commit a60bead

Browse files
first working concept
1 parent f5bd9ba commit a60bead

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

scripts/compact_alt.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env bash
2+
# setting the locale, some users have issues with different locales, this forces the correct one
3+
export LC_ALL=en_US.UTF-8
4+
5+
current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
6+
source $current_dir/utils.sh
7+
8+
main()
9+
{
10+
# get options
11+
min_width=$(get_tmux_option "@dracula-compact-min-width" "200")
12+
13+
# get current window with
14+
local window_width
15+
window_width=$(tmux display-message -p "#{window_width}")
16+
17+
# determine whether narrow
18+
if [[ "$window_width" -lt "$min_width" ]]; then
19+
narrow=true
20+
else
21+
narrow=false
22+
fi
23+
24+
# get whether narrow previously
25+
narrow_mode="$(tmux show-option -gqv '@dracula-narrow-mode')"
26+
27+
# if width changed, set global var and reload
28+
if [[ "$narrow" != "$narrow_mode" ]]; then
29+
tmux set -g @dracula-narrow-mode $narrow
30+
tmux source-file ~/.config/tmux/tmux.conf
31+
fi
32+
echo "$window_width aa $narrow"
33+
}
34+
35+
#run main driver program
36+
main

scripts/dracula.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,15 @@ main() {
3737
time_format=$(get_tmux_option "@dracula-time-format" "")
3838
show_ssh_session_port=$(get_tmux_option "@dracula-show-ssh-session-port" false)
3939
show_libreview=$(get_tmux_option "@dracula-show-libreview" false)
40-
IFS=' ' read -r -a plugins <<< $(get_tmux_option "@dracula-plugins" "battery network weather")
4140
show_empty_plugins=$(get_tmux_option "@dracula-show-empty-plugins" true)
4241

42+
narrow_mode=$(get_tmux_option "@dracula-narrow-mode" false)
43+
if $narrow_mode; then
44+
IFS=' ' read -r -a plugins <<< $(get_tmux_option "@dracula-narrow-plugins" "compact-alt battery network weather")
45+
else
46+
IFS=' ' read -r -a plugins <<< $(get_tmux_option "@dracula-plugins" "battery network weather")
47+
fi
48+
4349
# Dracula Color Pallette
4450
white="#f8f8f2"
4551
gray="#44475a"
@@ -188,6 +194,11 @@ main() {
188194
script="${script} not found!"
189195
fi
190196

197+
elif [ $plugin = "compact-alt" ]; then
198+
IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-compact-alt-colors" "dark_gray white")
199+
tmux set-option -g status-right-length 250
200+
script="#($current_dir/compact_alt.sh)"
201+
191202
elif [ $plugin = "cwd" ]; then
192203
IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-cwd-colors" "dark_gray white")
193204
tmux set-option -g status-right-length 250

0 commit comments

Comments
 (0)