#!/bin/bash

if command -v waydroid &> /dev/null; then
  waydroid session stop
fi

short_session_tracker_file="/tmp/chimeraos-short-session-tracker"
[ -f "$short_session_tracker_file" ] && rm "$short_session_tracker_file"

if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
  # SESSION_ID=$(loginctl session-status | head -n 1 | awk '{print $1}')
  # loginctl terminate-session $SESSION_ID
  loginctl terminate-user ""
else
  cosmic-session-oneshot
fi