Skip to content

Commit 1920ddd

Browse files
add docs and better defaults
1 parent 44290df commit 1920ddd

File tree

2 files changed

+46
-4
lines changed

2 files changed

+46
-4
lines changed

docs/CONFIG.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- [Plugins](#Plugins)
1010
- [attached-clients](#attached-clients---up)
1111
- [battery](#battery---up)
12+
- [compact-alt](#compact-alt---up)
1213
- [continuum](#continuum---up)
1314
- [cpu-usage](#cpu-usage---up)
1415
- [cwd](#cwd---up)
@@ -198,6 +199,43 @@ alternatively, if you have no battery and would like a nerdfont icon to indicate
198199
set -g @dracula-no-battery-label ""
199200
```
200201

202+
### compact-alt - [up](#table-of-contents)
203+
This widget allows the user to switch to an alternate list of widgets when the terminal becomes narrow.
204+
205+
to set what widgets should be shown in narrow mode, set the following variable. *make sure to include the compact-alt widget as you won't be able to switch out of narrow mode otherwise.*
206+
207+
```bash
208+
set -g @dracula-narrow-plugins "compact-alt battery network weather"
209+
```
210+
211+
to determine when to switch to narrow mode, set the following variable.
212+
any value below this threshold is considered narrow.
213+
214+
```bash
215+
set -g @dracula-compact-min-width 140
216+
```
217+
218+
the compact-alt widget needs to reload your tmux config to switch from wide to narrow and back.
219+
therefore, you need to make sure to set the right path to your config file.
220+
221+
```bash
222+
set -g @dracula-config-path "$HOME/.config/tmux/tmux.conf"
223+
```
224+
225+
if you want to see your window with and whether narrow mode is active, set the following, which is false per default.
226+
227+
```bash
228+
set -g @dracula-compact-alt-verbose true
229+
```
230+
231+
this widget maintains a global variable informing about whether narrow mode is active.
232+
that variable should never be touched by the user and could potentially be used by other widgets/ plugins.
233+
234+
```bash
235+
# NEVER DO:
236+
set -g @dracula-narrow-mode some-value
237+
```
238+
201239
### continuum - [up](#table-of-contents)
202240

203241
Set the output mode. Options are:

scripts/compact_alt.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ source $current_dir/utils.sh
88
main()
99
{
1010
# get options
11-
min_width=$(get_tmux_option "@dracula-compact-min-width" "200")
11+
min_width=$(get_tmux_option "@dracula-compact-min-width" "140")
1212

1313
# get current window with
1414
local window_width
@@ -27,10 +27,14 @@ main()
2727
# if width changed, set global var and reload
2828
if [[ "$narrow" != "$narrow_mode" ]]; then
2929
tmux set -g @dracula-narrow-mode $narrow
30-
tmux source-file $(get_tmux_option "@dracula-config-path" "$HOME/.config/tmux/tmux.conf")
30+
tmux source-file "$(get_tmux_option "@dracula-config-path" "$HOME/.config/tmux/tmux.conf")"
31+
fi
32+
33+
# show widget info if verbose
34+
verbose=$(get_tmux_option "@dracula-compact-alt-verbose" false)
35+
if $verbose; then
36+
echo "$window_width - $narrow"
3137
fi
32-
# TODO: test and think about what to display
33-
echo "$window_width aa $narrow"
3438
}
3539

3640
#run main driver program

0 commit comments

Comments
 (0)