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"
|
||||
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}!"
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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')):
|
||||
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': rel_variant,
|
||||
'variant': variant_name,
|
||||
'name': filename,
|
||||
'path': os.path.join(root, 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__':
|
||||
|
||||
Loading…
Reference in New Issue
Block a user