Replace the embedded python3 .desktop walker/parser with Quickshell's
DesktopEntries singleton (parses XDG entries, filters Hidden/NoDisplay,
dedupes by id natively). buildApps() maps DesktopEntry -> launcher rows;
apps becomes a reactive binding. Removes the only python dependency and
the Process/StdioCollector machinery.
Verified: appCount populates, search returns Firefox, launch fields map
to uwsm desktop-id form.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
504 -return`import json, os, re, shlex\n\ndef truth(value):\n return str(value or '').strip().lower() == 'true'\n\ndef clean_exec(value):\n return re.sub(r' ?%[fFuUdDnNickvm]', '', value or '').strip()\n\ndef parse_desktop(path):\n data = {}\n section = ''\n try:\n text = open(path, 'r', encoding='utf-8', errors='replace').read().splitlines()\n except OSError:\n return None\n for line in text:\n line = line.strip()\n if not line or line.startswith(('#', ';')):\n continue\n if line.startswith('[') and line.endswith(']'):\n section = line[1:-1]\n continue\n if section != 'Desktop Entry' or '=' not in line:\n continue\n key, value = line.split('=', 1)\n if '[' not in key and key not in data:\n data[key] = value\n if data.get('Type', 'Application') != 'Application':\n return None\n if truth(data.get('NoDisplay')) or truth(data.get('Hidden')):\n return None\n name = data.get('Name') or data.get('GenericName')\n if not name:\n return None\n base = os.path.basename(path)\n command = clean_exec(data.get('Exec', ''))\n try:\n argv = shlex.split(command)\n except ValueError:\n argv = []\n return {\n 'id': 'app:' + base,\n 'title': name,\n 'subtitle': data.get('Comment') or data.get('GenericName') or base,\n 'desktopId': base,\n 'desktopPath': path,\n 'exec': command,\n 'execArgv': argv,\n 'icon': data.get('Icon', ''),\n 'terminal': truth(data.get('Terminal')),\n 'route': 'desktop-entry'\n }\n\nroots = []\nhome = os.environ.get('XDG_DATA_HOME') or os.path.expanduser('~/.local/share')\nroots.append(home)\nroots.extend([p for p in os.environ.get('XDG_DATA_DIRS', '/usr/local/share:/usr/share').split(':') if p])\nseen = set()\napps = []\nfor root in roots:\n appdir = os.path.join(root, 'applications')\n if not os.path.isdir(appdir):\n continue\n for current, _, files in os.walk(appdir):\n for name in files:\n if not name.endswith('.desktop'):\n continue\n path = os.path.join(current, name)\n rel = os.path.relpath(path, appdir).replace(os.sep, '-')\n if rel in seen:\n continue\n row = parse_desktop(path)\n if not row:\n continue\n row['desktopId'] = rel\n row['id'] = 'app:' + rel\n seen.add(rel)\n apps.append(row)\napps.sort(key=lambda item: item['title'].casefold())\nprint(json.dumps(apps[:400], ensure_ascii=False))\n`;