fix: add Flatpak Discord paths, multi-dir wallpaper scanner, local user pinned apps, and reverse domain icon mapping
This commit is contained in:
parent
087e882a35
commit
d7b1a6a4e7
@ -253,6 +253,13 @@ deploy_configs() {
|
|||||||
ln -snf "${SCRIPT_DIR}/fastfetch" "${TARGET_CONFIG_DIR}/fastfetch" || cp -r "${SCRIPT_DIR}/fastfetch" "${TARGET_CONFIG_DIR}/fastfetch"
|
ln -snf "${SCRIPT_DIR}/fastfetch" "${TARGET_CONFIG_DIR}/fastfetch" || cp -r "${SCRIPT_DIR}/fastfetch" "${TARGET_CONFIG_DIR}/fastfetch"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Wallpapers Deployment
|
||||||
|
if [ -d "${SCRIPT_DIR}/quickshell/wallpapers" ]; then
|
||||||
|
info "Deploying default wallpapers to ~/Pictures/Wallpapers..."
|
||||||
|
mkdir -p "${HOME}/Pictures/Wallpapers"
|
||||||
|
cp -rn "${SCRIPT_DIR}/quickshell/wallpapers/"* "${HOME}/Pictures/Wallpapers/" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
success "QuickShell configuration linked successfully to ${TARGET_CONFIG_DIR}!"
|
success "QuickShell configuration linked successfully to ${TARGET_CONFIG_DIR}!"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -118,12 +118,23 @@ Item {
|
|||||||
for (let i = 0; i < parsed.apps.length; i++) {
|
for (let i = 0; i < parsed.apps.length; i++) {
|
||||||
let a = parsed.apps[i]
|
let a = parsed.apps[i]
|
||||||
if (a.icon) {
|
if (a.icon) {
|
||||||
if (a.id) newMap[a.id.toLowerCase()] = a.icon
|
if (a.id) {
|
||||||
if (a.id) newMap[a.id.replace(/\.desktop$/, "").toLowerCase()] = a.icon
|
let rawId = a.id.toLowerCase()
|
||||||
|
let cleanId = rawId.replace(/\.desktop$/, "")
|
||||||
|
newMap[rawId] = a.icon
|
||||||
|
newMap[cleanId] = a.icon
|
||||||
|
let parts = cleanId.split(".")
|
||||||
|
if (parts.length > 1) {
|
||||||
|
let lastPart = parts[parts.length - 1]
|
||||||
|
if (lastPart) newMap[lastPart] = a.icon
|
||||||
|
}
|
||||||
|
}
|
||||||
if (a.name) newMap[a.name.toLowerCase()] = a.icon
|
if (a.name) newMap[a.name.toLowerCase()] = a.icon
|
||||||
if (a.exec) {
|
if (a.exec) {
|
||||||
let cleanExec = a.exec.replace(/%[a-zA-Z]/g, "").trim().split(/\s+/)[0]
|
let cleanExec = a.exec.replace(/%[a-zA-Z]/g, "").trim().split(/\s+/)[0]
|
||||||
|
let execName = cleanExec.split("/").pop().toLowerCase()
|
||||||
newMap[cleanExec.toLowerCase()] = a.icon
|
newMap[cleanExec.toLowerCase()] = a.icon
|
||||||
|
newMap[execName] = a.icon
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,10 +4,14 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
def read_pinned():
|
def read_pinned():
|
||||||
p = os.path.expanduser('~/.config/quickshell/config/pinned_apps.json')
|
user_file = os.path.expanduser('~/.config/quickshell_user_pinned.json')
|
||||||
if os.path.exists(p):
|
template_file = os.path.expanduser('~/.config/quickshell/config/pinned_apps.json')
|
||||||
|
|
||||||
|
target = user_file if os.path.exists(user_file) else template_file
|
||||||
|
|
||||||
|
if os.path.exists(target):
|
||||||
try:
|
try:
|
||||||
with open(p, 'r', encoding='utf-8') as f:
|
with open(target, 'r', encoding='utf-8') as f:
|
||||||
data = json.load(f)
|
data = json.load(f)
|
||||||
print(json.dumps(data), flush=True)
|
print(json.dumps(data), flush=True)
|
||||||
return
|
return
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import sys
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
||||||
CONFIG_PATH = os.path.expanduser("~/.config/quickshell/config/pinned_apps.json")
|
CONFIG_PATH = os.path.expanduser("~/.config/quickshell_user_pinned.json")
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
|
|||||||
@ -217,16 +217,23 @@ def sync_discord(bg, surface, current_line, fg, accent, sub_accent, is_dark):
|
|||||||
f.write(css_content)
|
f.write(css_content)
|
||||||
|
|
||||||
for client_dir in [
|
for client_dir in [
|
||||||
|
os.path.expanduser('~/.config/vesktop/themes'),
|
||||||
|
os.path.expanduser('~/.config/Vencord/themes'),
|
||||||
os.path.expanduser('~/.config/equibop/themes'),
|
os.path.expanduser('~/.config/equibop/themes'),
|
||||||
os.path.expanduser('~/.config/equicord/themes'),
|
os.path.expanduser('~/.config/equicord/themes'),
|
||||||
os.path.expanduser('~/.config/Vencord/themes'),
|
os.path.expanduser('~/.config/discord/themes'),
|
||||||
os.path.expanduser('~/.config/vesktop/themes')
|
os.path.expanduser('~/.var/app/dev.vencord.Vesktop/config/vesktop/themes'),
|
||||||
|
os.path.expanduser('~/.var/app/dev.vencord.Vesktop/config/Vencord/themes'),
|
||||||
|
os.path.expanduser('~/.var/app/com.discordapp.Discord/config/discord/themes'),
|
||||||
|
os.path.expanduser('~/.var/app/com.discordapp.Discord/config/Vencord/themes')
|
||||||
]:
|
]:
|
||||||
if os.path.exists(os.path.dirname(client_dir)):
|
try:
|
||||||
os.makedirs(client_dir, exist_ok=True)
|
os.makedirs(client_dir, exist_ok=True)
|
||||||
css_file = os.path.join(client_dir, 'quickshell-theme.css')
|
css_file = os.path.join(client_dir, 'quickshell-theme.css')
|
||||||
with open(css_file, 'w') as f:
|
with open(css_file, 'w', encoding='utf-8') as f:
|
||||||
f.write(css_content)
|
f.write(css_content)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
def sync_vscode(bg, surface, current_line, fg, accent, sub_accent, is_dark):
|
def sync_vscode(bg, surface, current_line, fg, accent, sub_accent, is_dark):
|
||||||
import json
|
import json
|
||||||
|
|||||||
@ -4,22 +4,34 @@ import json
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
def scan_wallpapers():
|
def scan_wallpapers():
|
||||||
base_dir = os.path.expanduser('~/Pictures/Wallpapers')
|
search_dirs = [
|
||||||
|
os.path.expanduser('~/Pictures/Wallpapers'),
|
||||||
|
os.path.expanduser('~/.config/quickshell/wallpapers'),
|
||||||
|
'/usr/share/wallpapers',
|
||||||
|
'/usr/share/backgrounds'
|
||||||
|
]
|
||||||
res = []
|
res = []
|
||||||
|
seen = set()
|
||||||
|
|
||||||
if os.path.exists(base_dir):
|
for base_dir in search_dirs:
|
||||||
|
if not os.path.exists(base_dir):
|
||||||
|
continue
|
||||||
for root, dirs, files in os.walk(base_dir):
|
for root, dirs, files in os.walk(base_dir):
|
||||||
rel_variant = os.path.relpath(root, base_dir)
|
for filename in files:
|
||||||
if rel_variant != '.':
|
if filename.lower().endswith(('.png', '.jpg', '.jpeg', '.webp', '.svg')):
|
||||||
for filename in files:
|
full_path = os.path.join(root, filename)
|
||||||
if filename.lower().endswith(('.png', '.jpg', '.jpeg', '.webp', '.svg')):
|
if full_path in seen:
|
||||||
res.append({
|
continue
|
||||||
'variant': rel_variant,
|
seen.add(full_path)
|
||||||
'name': filename,
|
|
||||||
'path': os.path.join(root, filename)
|
variant_name = os.path.basename(root) if root != base_dir else os.path.splitext(filename)[0]
|
||||||
})
|
res.append({
|
||||||
|
'variant': variant_name,
|
||||||
|
'name': filename,
|
||||||
|
'path': full_path
|
||||||
|
})
|
||||||
|
|
||||||
res.sort(key=lambda x: (x['variant'], x['name']))
|
res.sort(key=lambda x: (x['variant'].lower(), x['name'].lower()))
|
||||||
print(json.dumps(res), flush=True)
|
print(json.dumps(res), flush=True)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user