summaryrefslogtreecommitdiff
path: root/src/.tmux/theme-switch.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/.tmux/theme-switch.sh')
-rwxr-xr-xsrc/.tmux/theme-switch.sh45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/.tmux/theme-switch.sh b/src/.tmux/theme-switch.sh
new file mode 100755
index 0000000..3989c0a
--- /dev/null
+++ b/src/.tmux/theme-switch.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+THEMES_DIR="$HOME/.tmux/themes"
+SELECTED="$THEMES_DIR/selected.theme"
+
+# Print available themes
+list_themes() {
+ echo "Available tmux themes:"
+ for theme_file in "$THEMES_DIR"/*.theme; do
+ basename "$theme_file" .theme
+ done
+}
+
+# Switch to a given theme
+switch_theme() {
+ local theme="$1"
+ local theme_path="$THEMES_DIR/$theme.theme"
+
+ if [[ ! -f "$theme_path" ]]; then
+ echo "Error: Theme '$theme' not found."
+ echo
+ list_themes
+ exit 1
+ fi
+
+ ln -sf "$theme_path" "$SELECTED"
+
+ # Check if tmux is running and reload config
+ if tmux info &>/dev/null; then
+ tmux source-file "$HOME/.tmux.conf"
+ tmux display-message "Switched to tmux theme: $theme"
+ else
+ echo "Theme '$theme' selected. Start tmux to see it."
+ fi
+}
+
+# Main logic
+if [[ $# -eq 0 ]]; then
+ list_themes
+ echo
+ echo "Usage: $0 <theme-name>"
+ exit 0
+else
+ switch_theme "$1"
+fi