#!/usr/bin/env bash
set -e

echo "Refreshing KDE package cache..."
if command -v kbuildsycoca6 >/dev/null 2>&1; then
    kbuildsycoca6
else
    echo "kbuildsycoca6 not found; skipping cache refresh."
fi

echo "Restarting Plasma Shell..."
systemctl --user restart plasma-plasmashell.service || {
    echo "systemd restart failed; falling back to kquitapp6/plasmashell."
    kquitapp6 plasmashell || true
    nohup plasmashell >/tmp/nebula-plasmashell.log 2>&1 &
}

echo "Plasma Shell reload requested."
