blob: 3989c0a60eb3c1b59831aa19fa18eb02db4a6149 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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
|