diff --git a/README.md b/README.md index 639a6f4..623ae40 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ A pack of various themes for Tmux. ## Installation +### Install manually + 1. Clone repo to local machine: git clone https://github.com/jimeh/tmux-themepack.git ~/.tmux-themepack @@ -13,6 +15,21 @@ A pack of various themes for Tmux. source-file "${HOME}/.tmux-themepack/powerline/block/green.tmuxtheme" +### Install using [Tmux Plugin Manager](https://github.com/tmux-plugins/tpm) + +1. Add plugin to the list of TPM plugins in `.tmux.conf`: + + set -g @plugin 'jimeh/tmux-themepack' + +2. Hit `prefix + I` to fetch the plugin and source it. The plugin should now be working. + +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'` +- `...` ## Themes diff --git a/themepack.tmux b/themepack.tmux new file mode 100755 index 0000000..ff18863 --- /dev/null +++ b/themepack.tmux @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +theme_option="@themepack" +default_theme='block/blue' + +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 +} + +main() { + local theme="$(get_tmux_option "$theme_option" "$default_theme")" + tmux source-file "$CURRENT_DIR/powerline/${theme}.tmuxtheme" +} +main