-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_konsole_profiles.py
More file actions
273 lines (226 loc) · 7.92 KB
/
create_konsole_profiles.py
File metadata and controls
273 lines (226 loc) · 7.92 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
#!/usr/bin/env python3
"""
Create Konsole profiles with optimized color schemes for forest backgrounds
"""
from pathlib import Path
import json
def create_konsole_profiles(images_info):
"""
Create Konsole profile files with appropriate color schemes
"""
konsole_dir = Path.home() / ".local" / "share" / "konsole"
konsole_dir.mkdir(parents=True, exist_ok=True)
# Color schemes optimized for different background types
color_schemes = {
"bright": {
# For dark backgrounds - bright, high contrast colors
"name": "ForestBright",
"Foreground": "230,230,230",
"Background": "10,10,10,180", # Semi-transparent dark
"Color0": "40,40,40", # Black
"Color1": "255,100,100", # Red
"Color2": "100,255,100", # Green
"Color3": "255,255,100", # Yellow
"Color4": "100,150,255", # Blue
"Color5": "255,100,255", # Magenta
"Color6": "100,255,255", # Cyan
"Color7": "240,240,240", # White
"Color0Intense": "100,100,100",
"Color1Intense": "255,150,150",
"Color2Intense": "150,255,150",
"Color3Intense": "255,255,150",
"Color4Intense": "150,200,255",
"Color5Intense": "255,150,255",
"Color6Intense": "150,255,255",
"Color7Intense": "255,255,255",
},
"light": {
# For medium/misty backgrounds - soft but visible
"name": "ForestLight",
"Foreground": "240,240,240",
"Background": "20,20,25,160",
"Color0": "50,50,50",
"Color1": "255,120,120",
"Color2": "120,255,120",
"Color3": "255,255,120",
"Color4": "120,180,255",
"Color5": "255,120,255",
"Color6": "120,255,255",
"Color7": "250,250,250",
"Color0Intense": "120,120,120",
"Color1Intense": "255,160,160",
"Color2Intense": "160,255,160",
"Color3Intense": "255,255,160",
"Color4Intense": "160,210,255",
"Color5Intense": "255,160,255",
"Color6Intense": "160,255,255",
"Color7Intense": "255,255,255",
},
"dark": {
# For bright/light backgrounds - dark, readable text
"name": "ForestDark",
"Foreground": "40,40,40",
"Background": "240,240,240,180",
"Color0": "20,20,20",
"Color1": "180,0,0",
"Color2": "0,150,0",
"Color3": "180,140,0",
"Color4": "0,80,180",
"Color5": "180,0,180",
"Color6": "0,150,150",
"Color7": "200,200,200",
"Color0Intense": "80,80,80",
"Color1Intense": "220,0,0",
"Color2Intense": "0,200,0",
"Color3Intense": "220,180,0",
"Color4Intense": "0,120,220",
"Color5Intense": "220,0,220",
"Color6Intense": "0,200,200",
"Color7Intense": "255,255,255",
},
"medium": {
# Balanced for medium-toned backgrounds
"name": "ForestMedium",
"Foreground": "220,220,220",
"Background": "30,30,35,170",
"Color0": "45,45,45",
"Color1": "255,110,110",
"Color2": "110,255,110",
"Color3": "255,255,110",
"Color4": "110,170,255",
"Color5": "255,110,255",
"Color6": "110,255,255",
"Color7": "245,245,245",
"Color0Intense": "110,110,110",
"Color1Intense": "255,150,150",
"Color2Intense": "150,255,150",
"Color3Intense": "255,255,150",
"Color4Intense": "150,200,255",
"Color5Intense": "255,150,255",
"Color6Intense": "150,255,255",
"Color7Intense": "255,255,255",
}
}
created_profiles = []
created_colorschemes = []
# Create color scheme files
for scheme_name, colors in color_schemes.items():
colorscheme_file = konsole_dir / f"{colors['name']}.colorscheme"
colorscheme_content = f"""[Background]
Color={colors['Background']}
[BackgroundIntense]
Color={colors['Background']}
[Color0]
Color={colors['Color0']}
[Color0Intense]
Color={colors['Color0Intense']}
[Color1]
Color={colors['Color1']}
[Color1Intense]
Color={colors['Color1Intense']}
[Color2]
Color={colors['Color2']}
[Color2Intense]
Color={colors['Color2Intense']}
[Color3]
Color={colors['Color3']}
[Color3Intense]
Color={colors['Color3Intense']}
[Color4]
Color={colors['Color4']}
[Color4Intense]
Color={colors['Color4Intense']}
[Color5]
Color={colors['Color5']}
[Color5Intense]
Color={colors['Color5Intense']}
[Color6]
Color={colors['Color6']}
[Color6Intense]
Color={colors['Color6Intense']}
[Color7]
Color={colors['Color7']}
[Color7Intense]
Color={colors['Color7Intense']}
[Foreground]
Color={colors['Foreground']}
[ForegroundIntense]
Color={colors['Foreground']}
[General]
Description={colors['name']}
Opacity=0.9
Wallpaper=
"""
with open(colorscheme_file, 'w') as f:
f.write(colorscheme_content)
created_colorschemes.append(str(colorscheme_file))
print(f" ✓ Created color scheme: {colors['name']}")
# Create profile for each image
for img in images_info:
profile_name = f"Forest_{img['name'].title().replace('_', '')}"
profile_file = konsole_dir / f"{profile_name}.profile"
color_scheme_name = color_schemes[img['colors']]['name']
profile_content = f"""[Appearance]
ColorScheme={color_scheme_name}
Font=Hack,11,-1,5,50,0,0,0,0,0
LineSpacing=0
UseFontLineChararacters=true
[General]
Command=/bin/bash
Name={profile_name}
Parent=FALLBACK/
[Interaction Options]
UnderlineFilesEnabled=true
[Scrolling]
HistorySize=10000
[Terminal Features]
BlinkingCursorEnabled=true
"""
with open(profile_file, 'w') as f:
f.write(profile_content)
created_profiles.append({
'profile': str(profile_file),
'name': profile_name,
'image': img['path'],
'colorscheme': color_scheme_name
})
print(f" ✓ Created profile: {profile_name}")
return created_profiles, created_colorschemes
def create_wallpaper_script(profiles_info):
"""
Create a helper script to set wallpapers for profiles
(Konsole doesn't support wallpapers directly in profiles, needs manual setting)
"""
script_path = Path.home() / "Documents" / "PythonScripts" / "TokenHUD" / "set_konsole_wallpapers.sh"
script_content = """#!/bin/bash
# Helper script to set Konsole wallpapers
# Konsole profiles don't directly support wallpaper setting via config files
# You need to manually set them or use this as a reference
echo "Konsole Profile Wallpaper Setup Instructions"
echo "=============================================="
echo ""
echo "To set wallpapers for each profile:"
echo "1. Open Konsole"
echo "2. Go to Settings > Edit Current Profile"
echo "3. Select the Appearance tab"
echo "4. Click 'Edit...' next to Color scheme"
echo "5. Go to the Background tab"
echo "6. Set the wallpaper image for each profile"
echo ""
echo "Profile to Image Mapping:"
echo "========================="
"""
for profile in profiles_info:
script_content += f'\necho "{profile["name"]} -> {profile["image"]}"\n'
script_content += """
echo ""
echo "Or use kreadconfig6/kwriteconfig6 to automate (if available)"
echo "=============================================="
"""
with open(script_path, 'w') as f:
f.write(script_content)
script_path.chmod(0o755)
return str(script_path)
if __name__ == "__main__":
# This will be called from the main script
pass