mirror of
https://github.com/jimeh/tmux-themepack.git
synced 2026-02-19 03:16:38 +00:00
Enable loading non-powerline themes via TMP
Without break backwards compatibility. Should fix issue #6.
This commit is contained in:
@@ -25,10 +25,11 @@ A pack of various themes for Tmux.
|
||||
|
||||
You can pick and choose a theme via `.tmux.conf` option:
|
||||
|
||||
- `set -g @themepack 'block/blue'` (default)
|
||||
- `set -g @themepack 'block/cyan'`
|
||||
- `set -g @themepack 'default/gray'`
|
||||
- `set -g @themepack 'double/megenta'`
|
||||
- `set -g @themepack 'basic'` (default)
|
||||
- `set -g @themepack 'powerline/block/blue'`
|
||||
- `set -g @themepack 'powerline/block/cyan'`
|
||||
- `set -g @themepack 'powerline/default/gray'`
|
||||
- `set -g @themepack 'powerline/double/megenta'`
|
||||
- `...`
|
||||
|
||||
## Themes
|
||||
|
||||
@@ -3,21 +3,27 @@
|
||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
theme_option="@themepack"
|
||||
default_theme='block/blue'
|
||||
default_theme='basic'
|
||||
|
||||
get_tmux_option() {
|
||||
local option="$1"
|
||||
local default_value="$2"
|
||||
local option_value="$(tmux show-option -gqv "$option")"
|
||||
if [ -z "$option_value" ]; then
|
||||
echo "$default_value"
|
||||
else
|
||||
echo "$option_value"
|
||||
fi
|
||||
local option="$1"
|
||||
local default_value="$2"
|
||||
local option_value="$(tmux show-option -gqv "$option")"
|
||||
|
||||
if [ -n "$option_value" ]; then
|
||||
echo "$option_value"
|
||||
else
|
||||
echo "$default_value"
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
local theme="$(get_tmux_option "$theme_option" "$default_theme")"
|
||||
tmux source-file "$CURRENT_DIR/powerline/${theme}.tmuxtheme"
|
||||
local theme="$(get_tmux_option "$theme_option" "$default_theme")"
|
||||
if [ -f "$CURRENT_DIR/${theme}.tmuxtheme" ]; then
|
||||
tmux source-file "$CURRENT_DIR/${theme}.tmuxtheme"
|
||||
else
|
||||
tmux source-file "$CURRENT_DIR/powerline/${theme}.tmuxtheme"
|
||||
fi
|
||||
}
|
||||
|
||||
main
|
||||
|
||||
Reference in New Issue
Block a user