From d7b1a6a4e7b1a3755f8777d25caf4fecd8d78071 Mon Sep 17 00:00:00 2001 From: Sho Date: Sat, 1 Aug 2026 23:42:35 +0900 Subject: [PATCH] fix: add Flatpak Discord paths, multi-dir wallpaper scanner, local user pinned apps, and reverse domain icon mapping --- install.sh | 7 ++++ quickshell/services/AppLauncherService.qml | 15 ++++++-- .../services/python/read_pinned_apps.py | 10 ++++-- .../services/python/save_pinned_apps.py | 2 +- quickshell/services/python/theme_sync.py | 15 +++++--- .../services/python/wallpaper_scanner.py | 36 ++++++++++++------- 6 files changed, 63 insertions(+), 22 deletions(-) diff --git a/install.sh b/install.sh index da3ae78..13ae7f1 100755 --- a/install.sh +++ b/install.sh @@ -253,6 +253,13 @@ deploy_configs() { ln -snf "${SCRIPT_DIR}/fastfetch" "${TARGET_CONFIG_DIR}/fastfetch" || cp -r "${SCRIPT_DIR}/fastfetch" "${TARGET_CONFIG_DIR}/fastfetch" 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}!" } diff --git a/quickshell/services/AppLauncherService.qml b/quickshell/services/AppLauncherService.qml index 9a9a9d4..6bcc005 100644 --- a/quickshell/services/AppLauncherService.qml +++ b/quickshell/services/AppLauncherService.qml @@ -118,12 +118,23 @@ Item { for (let i = 0; i < parsed.apps.length; i++) { let a = parsed.apps[i] if (a.icon) { - if (a.id) newMap[a.id.toLowerCase()] = a.icon - if (a.id) newMap[a.id.replace(/\.desktop$/, "").toLowerCase()] = a.icon + if (a.id) { + 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.exec) { 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[execName] = a.icon } } } diff --git a/quickshell/services/python/read_pinned_apps.py b/quickshell/services/python/read_pinned_apps.py index 6277360..3be10cf 100755 --- a/quickshell/services/python/read_pinned_apps.py +++ b/quickshell/services/python/read_pinned_apps.py @@ -4,10 +4,14 @@ import os import sys def read_pinned(): - p = os.path.expanduser('~/.config/quickshell/config/pinned_apps.json') - if os.path.exists(p): + user_file = os.path.expanduser('~/.config/quickshell_user_pinned.json') + 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: - with open(p, 'r', encoding='utf-8') as f: + with open(target, 'r', encoding='utf-8') as f: data = json.load(f) print(json.dumps(data), flush=True) return diff --git a/quickshell/services/python/save_pinned_apps.py b/quickshell/services/python/save_pinned_apps.py index 819ee9a..91414c3 100644 --- a/quickshell/services/python/save_pinned_apps.py +++ b/quickshell/services/python/save_pinned_apps.py @@ -3,7 +3,7 @@ import sys import json 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(): if len(sys.argv) > 1: diff --git a/quickshell/services/python/theme_sync.py b/quickshell/services/python/theme_sync.py index ba3ac4d..9fc8c2a 100644 --- a/quickshell/services/python/theme_sync.py +++ b/quickshell/services/python/theme_sync.py @@ -217,16 +217,23 @@ def sync_discord(bg, surface, current_line, fg, accent, sub_accent, is_dark): f.write(css_content) 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/equicord/themes'), - os.path.expanduser('~/.config/Vencord/themes'), - os.path.expanduser('~/.config/vesktop/themes') + os.path.expanduser('~/.config/discord/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) 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) + except Exception: + pass def sync_vscode(bg, surface, current_line, fg, accent, sub_accent, is_dark): import json diff --git a/quickshell/services/python/wallpaper_scanner.py b/quickshell/services/python/wallpaper_scanner.py index 5a406ef..8d0b367 100755 --- a/quickshell/services/python/wallpaper_scanner.py +++ b/quickshell/services/python/wallpaper_scanner.py @@ -4,22 +4,34 @@ import json import sys 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 = [] + 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): - rel_variant = os.path.relpath(root, base_dir) - if rel_variant != '.': - for filename in files: - if filename.lower().endswith(('.png', '.jpg', '.jpeg', '.webp', '.svg')): - res.append({ - 'variant': rel_variant, - 'name': filename, - 'path': os.path.join(root, filename) - }) + for filename in files: + if filename.lower().endswith(('.png', '.jpg', '.jpeg', '.webp', '.svg')): + full_path = os.path.join(root, filename) + if full_path in seen: + continue + seen.add(full_path) + + 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) if __name__ == '__main__':