fix: remove fastfetch overwriting from theme_sync.py and use ~/.config/fastfetch as reference
This commit is contained in:
parent
90634d2977
commit
b01a8cc752
@ -1,80 +1,89 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
|
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
|
||||||
"logo": {
|
"logo": {
|
||||||
"source": "~/.config/fastfetch/hamster_cookie.txt",
|
"source": "~/.config/fastfetch/hamster_cookie.txt",
|
||||||
"type": "file",
|
"color": {
|
||||||
"padding": {
|
"1": "magenta",
|
||||||
"top": 0,
|
"2": "yellow"
|
||||||
"left": 1,
|
},
|
||||||
"right": 3
|
"padding": {
|
||||||
}
|
"top": 1,
|
||||||
},
|
"left": 2,
|
||||||
"display": {
|
"right": 2
|
||||||
"separator": " ➜ ",
|
}
|
||||||
"color": {
|
|
||||||
"keys": "#a7c080",
|
|
||||||
"title": "#7fbbb3"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"modules": [
|
|
||||||
"title",
|
|
||||||
"separator",
|
|
||||||
{
|
|
||||||
"type": "os",
|
|
||||||
"key": "OS",
|
|
||||||
"keyColor": "cyan"
|
|
||||||
},
|
},
|
||||||
{
|
"display": {
|
||||||
"type": "host",
|
"separator": " ",
|
||||||
"key": "Host",
|
"color": {
|
||||||
"keyColor": "green"
|
"keys": "#a7c080",
|
||||||
|
"title": "#7fbbb3"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
"modules": [
|
||||||
"type": "kernel",
|
{
|
||||||
"key": "Kernel",
|
"type": "custom",
|
||||||
"keyColor": "yellow"
|
"format": "╭──────────────╮"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "uptime",
|
"type": "uptime",
|
||||||
"key": "Uptime",
|
"key": "│ uptime │",
|
||||||
"keyColor": "blue"
|
"keyColor": "cyan"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "packages",
|
"type": "os",
|
||||||
"key": "Packages",
|
"key": "│ distro │",
|
||||||
"keyColor": "magenta"
|
"keyColor": "green"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "shell",
|
"type": "packages",
|
||||||
"key": "Shell",
|
"key": "│ packages │",
|
||||||
"keyColor": "cyan"
|
"keyColor": "magenta"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "terminal",
|
"type": "terminal",
|
||||||
"key": "Terminal",
|
"key": "│ term │",
|
||||||
"keyColor": "green"
|
"keyColor": "red"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "wm",
|
"type": "shell",
|
||||||
"key": "WM",
|
"key": "│ shell │",
|
||||||
"keyColor": "yellow"
|
"keyColor": "yellow"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "cpu",
|
"type": "custom",
|
||||||
"key": "CPU",
|
"format": "├──────────────┤"
|
||||||
"keyColor": "blue"
|
},
|
||||||
},
|
{
|
||||||
{
|
"type": "cpu",
|
||||||
"type": "gpu",
|
"key": "│ % cpu load │",
|
||||||
"key": "GPU",
|
"keyColor": "magenta",
|
||||||
"keyColor": "magenta"
|
"temp": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "memory",
|
"type": "memory",
|
||||||
"key": "Memory",
|
"key": "│ memory │",
|
||||||
"keyColor": "red"
|
"keyColor": "red",
|
||||||
},
|
"format": "{1} / {2} ({3})"
|
||||||
"break",
|
},
|
||||||
"colors"
|
{
|
||||||
]
|
"type": "disk",
|
||||||
|
"key": "│ SSD1 │",
|
||||||
|
"keyColor": "green",
|
||||||
|
"format": "{1} / {2} ({3})"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "custom",
|
||||||
|
"format": "├──────────────┤"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "colors",
|
||||||
|
"key": "│ 🎨 colors │",
|
||||||
|
"keyColor": "yellow",
|
||||||
|
"symbol": "circle"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "custom",
|
||||||
|
"format": "╰──────────────╯"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,8 +15,8 @@
|
|||||||
"display": {
|
"display": {
|
||||||
"separator": " ",
|
"separator": " ",
|
||||||
"color": {
|
"color": {
|
||||||
"keys": "magenta",
|
"keys": "#a7c080",
|
||||||
"title": "bright_magenta"
|
"title": "#7fbbb3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"modules": [
|
"modules": [
|
||||||
@ -77,7 +77,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "colors",
|
"type": "colors",
|
||||||
"key": "│ 🎨 colors │",
|
"key": "│ 🎨 colors │",
|
||||||
"keyColor": "yellow",
|
"keyColor": "yellow",
|
||||||
"symbol": "circle"
|
"symbol": "circle"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1112,74 +1112,8 @@ theme[upload_end]="#ff80bf"
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def sync_fastfetch(bg, surface, current_line, fg, accent, sub_accent):
|
def sync_fastfetch(bg, surface, current_line, fg, accent, sub_accent):
|
||||||
import re
|
# Preserves user's exact master fastfetch configuration from ~/.config/fastfetch/
|
||||||
fastfetch_dir = os.path.expanduser('~/.config/fastfetch')
|
pass
|
||||||
os.makedirs(fastfetch_dir, exist_ok=True)
|
|
||||||
conf_path = os.path.join(fastfetch_dir, 'config.jsonc')
|
|
||||||
|
|
||||||
if os.path.exists(conf_path):
|
|
||||||
try:
|
|
||||||
with open(conf_path, 'r', encoding='utf-8') as f:
|
|
||||||
content = f.read()
|
|
||||||
|
|
||||||
modified = False
|
|
||||||
if '"keys"' in content:
|
|
||||||
content, count1 = re.subn(r'"keys"\s*:\s*"[^"]*"', f'"keys": "{accent}"', content)
|
|
||||||
if count1 > 0: modified = True
|
|
||||||
if '"title"' in content:
|
|
||||||
content, count2 = re.subn(r'"title"\s*:\s*"[^"]*"', f'"title": "{sub_accent}"', content)
|
|
||||||
if count2 > 0: modified = True
|
|
||||||
|
|
||||||
if not modified and '"display"' in content:
|
|
||||||
content = re.sub(r'"display"\s*:\s*\{', f'"display": {{\n "color": {{\n "keys": "{accent}",\n "title": "{sub_accent}"\n }},', content, count=1)
|
|
||||||
modified = True
|
|
||||||
|
|
||||||
if modified:
|
|
||||||
with open(conf_path, 'w', encoding='utf-8') as f:
|
|
||||||
f.write(content)
|
|
||||||
return
|
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
|
|
||||||
fastfetch_jsonc = f"""{{
|
|
||||||
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
|
|
||||||
"logo": {{
|
|
||||||
"source": "~/.config/fastfetch/hamster_cookie.txt",
|
|
||||||
"padding": {{
|
|
||||||
"right": 4
|
|
||||||
}}
|
|
||||||
}},
|
|
||||||
"display": {{
|
|
||||||
"color": {{
|
|
||||||
"keys": "{accent}",
|
|
||||||
"title": "{sub_accent}"
|
|
||||||
}}
|
|
||||||
}},
|
|
||||||
"modules": [
|
|
||||||
"title",
|
|
||||||
"separator",
|
|
||||||
"os",
|
|
||||||
"host",
|
|
||||||
"kernel",
|
|
||||||
"uptime",
|
|
||||||
"packages",
|
|
||||||
"shell",
|
|
||||||
"display",
|
|
||||||
"wm",
|
|
||||||
"terminal",
|
|
||||||
"cpu",
|
|
||||||
"gpu",
|
|
||||||
"memory",
|
|
||||||
"break",
|
|
||||||
"colors"
|
|
||||||
]
|
|
||||||
}}
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
with open(conf_path, 'w', encoding='utf-8') as f:
|
|
||||||
f.write(fastfetch_jsonc)
|
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def sync_ghostty(bg, surface, current_line, fg, accent, sub_accent):
|
def sync_ghostty(bg, surface, current_line, fg, accent, sub_accent):
|
||||||
ghostty_dir = os.path.expanduser('~/.config/ghostty')
|
ghostty_dir = os.path.expanduser('~/.config/ghostty')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user