-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdecktheme
More file actions
executable file
·163 lines (135 loc) · 5.2 KB
/
Copy pathdecktheme
File metadata and controls
executable file
·163 lines (135 loc) · 5.2 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#!/usr/bin/env python3
"""decktheme — Theme manager for DeckDroid"""
import sys
import json
import pathlib
import shutil
HOME = pathlib.Path.home()
DDROID = HOME / ".deckdroid"
CFG = DDROID / "config.json"
THEMES_DIR = DDROID / "themes"
GREEN = "\033[0;32m"
YELLOW = "\033[1;33m"
CYAN = "\033[0;36m"
RESET = "\033[0m"
BOLD = "\033[1m"
MAGENTA = "\033[0;35m"
VISUAL_THEMES = {
"cyberpunk": {"prompt_color": "green", "accent": "cyan"},
"ghost": {"prompt_color": "white", "accent": "grey"},
"blood": {"prompt_color": "red", "accent": "darkred"},
"matrix": {"prompt_color": "green", "accent": "darkgreen"},
"nord": {"prompt_color": "blue", "accent": "cyan"},
"dracula": {"prompt_color": "magenta", "accent": "purple"},
"monokai": {"prompt_color": "red", "accent": "yellow"},
"ocean": {"prompt_color": "blue", "accent": "cyan"},
}
PROFILE_THEMES = {
"hacker": {"color": "green", "accent": "cyan", "style": "matrix"},
"developer": {"color": "blue", "accent": "lightblue", "style": "clean"},
"writer": {"color": "purple", "accent": "white", "style": "minimal"},
"crypto": {"color": "magenta", "accent": "purple", "style": "dark"},
"radio": {"color": "navy", "accent": "cyan", "style": "signal"},
"hamradio": {"color": "navy", "accent": "cyan", "style": "signal"},
"iot": {"color": "cyan", "accent": "green", "style": "circuit"},
}
def load_cfg():
if CFG.exists():
return json.loads(CFG.read_text())
return {}
def save_cfg(cfg):
CFG.write_text(json.dumps(cfg, indent=2))
def apply_starship_theme(theme_name, is_profile=False):
starship_file = DDROID / "starship.toml"
if is_profile:
ptheme = PROFILE_THEMES.get(theme_name, {})
color = ptheme.get("color", "green")
else:
vtheme = VISUAL_THEMES.get(theme_name, {})
color = vtheme.get("prompt_color", "green")
# Create a minimal starship config
theme_config = f"""# DeckDroid Starship Theme - {theme_name}
add_newline = false
[character]
success_symbol = "[╰─❯](bold green)"
error_symbol = "[╰─❌](bold red)"
[username]
show_always = true
style_user = "bold green"
style_root = "bold red"
[hostname]
ssh_only = false
style = "bold cyan"
[directory]
truncation_length = 3
style = "bold white"
[git_branch]
style = "bold yellow"
[git_status]
style = "yellow"
# No battery section - use deckbat instead
"""
try:
starship_file.write_text(theme_config)
except Exception as e:
print(f"{YELLOW}Warning: Could not write starship config: {e}{RESET}")
def cmd_list(args):
cfg = load_cfg()
current = cfg.get("theme", {}).get("name", "cyberpunk")
active_profiles = cfg.get("profiles", [])
print(f"\n{BOLD}{CYAN}══ Visual Themes ════════════════════════════════{RESET}\n")
for name in VISUAL_THEMES:
if name == current:
print(f" {CYAN}● {name}{RESET} (active)")
else:
print(f" {name}")
print(f"\n{BOLD}{MAGENTA}══ Profile Themes ═════════════════════════════{RESET}\n")
for name in PROFILE_THEMES:
if name in active_profiles:
print(f" {CYAN}● {name}{RESET} (active profile)")
else:
print(f" {name}")
print()
def cmd_set(args):
if not args:
print(f"Usage: decktheme set <name>")
print(f"Visual themes: {', '.join(VISUAL_THEMES.keys())}")
print(f"Profile themes: {', '.join(PROFILE_THEMES.keys())}")
return
name = args[0]
is_profile_theme = name in PROFILE_THEMES
if name not in VISUAL_THEMES and name not in PROFILE_THEMES:
print(f"Unknown theme: {name}")
print(f"Available: {', '.join(list(VISUAL_THEMES.keys()) + list(PROFILE_THEMES.keys()))}")
return
cfg = load_cfg()
if "theme" not in cfg:
cfg["theme"] = {}
if is_profile_theme:
cfg["theme"]["name"] = name
cfg["theme"]["type"] = "profile"
cfg["theme"]["prompt_color"] = PROFILE_THEMES[name]["color"]
else:
cfg["theme"]["name"] = name
cfg["theme"]["type"] = "visual"
cfg["theme"]["prompt_color"] = VISUAL_THEMES[name]["prompt_color"]
save_cfg(cfg)
apply_starship_theme(name, is_profile_theme)
print(f"{GREEN}✓ Theme set to {name}{RESET}")
if is_profile_theme:
print(f" Profile theme applied (matches: {PROFILE_THEMES[name]['style']} style)")
print(f" Run 'source ~/.zshrc' to apply changes.")
CMDS = {"list": cmd_list, "set": cmd_set}
if __name__ == "__main__":
args = sys.argv[1:]
if not args or args[0] not in CMDS:
print(f"{BOLD}decktheme — Theme Manager{RESET}")
print(f"\nUsage: decktheme <command>")
print(f"\nCommands:")
print(f" {CYAN}list{RESET} Show all themes")
print(f" {CYAN}set{RESET} <name> Set theme")
print(f"\nVisual Themes: cyberpunk, ghost, blood, matrix, nord, dracula, monokai, ocean")
print(f"Profile Themes: hacker, developer, writer, crypto, radio, hamradio, iot")
print(f"\nProfile themes auto-match your active profile.")
sys.exit(1)
CMDS[args[0]](args[1:])