#!/usr/bin/bash # Check if running in a nested desktop if [[ "$PATH" =~ nested_plasma ]]; then # If running in a nested desktop, close the session immediately and exit qdbus-qt6 qdbus-qt6 org.kde.Shutdown /Shutdown org.kde.Shutdown.logout exit fi # If not running in a nested desktop, continue with normal script execution /usr/bin/steamrestart /usr/libexec/os-session-select gamescope if [[ ! -z $(systemctl status gdm | grep running) ]]; then exec gnome-session-quit --no-prompt fi if [[ ! -z $(systemctl status sddm | grep running) ]]; then exec qdbus-qt6 org.kde.Shutdown /Shutdown org.kde.Shutdown.logout fi