summaryrefslogtreecommitdiff
path: root/raveos-hyprland-theme/raveos-hyprland-apply.sh
diff options
context:
space:
mode:
Diffstat (limited to 'raveos-hyprland-theme/raveos-hyprland-apply.sh')
-rw-r--r--raveos-hyprland-theme/raveos-hyprland-apply.sh19
1 files changed, 12 insertions, 7 deletions
diff --git a/raveos-hyprland-theme/raveos-hyprland-apply.sh b/raveos-hyprland-theme/raveos-hyprland-apply.sh
index c53b943..133713b 100644
--- a/raveos-hyprland-theme/raveos-hyprland-apply.sh
+++ b/raveos-hyprland-theme/raveos-hyprland-apply.sh
@@ -174,17 +174,22 @@ while IFS=: read -r user _ uid gid _ home shell; do
runuser -u "$user" -- xdg-user-dirs-update 2>/dev/null || true
dms_session="${home}/.local/state/DankMaterialShell/session.json"
- if [[ -f "$dms_session" ]]; then
- python3 -c "
-import json, sys
-with open('${dms_session}') as f:
- d = json.load(f)
+ mkdir -p "$(dirname "$dms_session")"
+ python3 -c "
+import json, os
+path = '${dms_session}'
+d = {}
+if os.path.isfile(path):
+ try:
+ with open(path) as f:
+ d = json.load(f)
+ except Exception:
+ d = {}
if not d.get('wallpaperPath'):
d['wallpaperPath'] = '/usr/share/raveos/hyprland-theme/theme-data/background.jpg'
- with open('${dms_session}', 'w') as f:
+ with open(path, 'w') as f:
json.dump(d, f, indent=2)
" 2>/dev/null || true
- fi
chown -R "${uid}:${gid}" "$home"