added adaptive quickshell

This commit is contained in:
wt committed 2026-11-17 18:15:16 +07:00
1 parent 6eb56d2065
commit 5b33a73fd8
189 files changed
+8678 -15

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
#!/usr/bin/env python3
"""Install only the launcher and Settings entry, with backups; no packages/session changes."""
import argparse
from datetime import datetime
import os
from pathlib import Path
import shlex
import shutil
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--apply', action='store_true', help='write files (default: show plan)')
args = parser.parse_args()
repo = Path(__file__).resolve().parent.parent
home = Path.home()
data = Path(os.environ.get('XDG_DATA_HOME', home / '.local/share'))
state = Path(os.environ.get('XDG_STATE_HOME', home / '.local/state'))
launcher = home / '.local/bin/adaptive-shell'
exec_path = str(launcher).replace('\\', '\\\\').replace('"', '\\"').replace('`', '\\`').replace('$', '\\$').replace('%', '%%')
files = {
launcher: '#!/bin/sh\nexec ' + shlex.quote(str(repo / 'hypr/bin/adaptive-shell')) + ' "$@"\n',
data / 'applications/adaptive-settings.desktop': '[Desktop Entry]\nType=Application\nName=Settings\nComment=Adaptive shell settings\nExec="' + exec_path + '" settings\nIcon=preferences-system\nTerminal=false\nCategories=Settings;DesktopSettings;\n',
}
backup = state / 'adaptive-shell/backups' / datetime.now().strftime('%Y%m%d-%H%M%S-%f')
for i, (path, contents) in enumerate(files.items()):
print(('WRITE ' if args.apply else 'PLAN ') + str(path))
if args.apply:
path.parent.mkdir(parents=True, exist_ok=True)
if path.exists() or path.is_symlink():
backup.mkdir(parents=True, exist_ok=True)
shutil.copy2(path, backup / (str(i) + '-' + path.name), follow_symlinks=True)
temporary = path.with_name(path.name + '.adaptive-tmp')
with temporary.open('x') as stream:
stream.write(contents)
temporary.chmod(0o755 if path == launcher else 0o644)
temporary.replace(path)
if args.apply:
print('Backups (if needed):', backup)