#!/bin/bash

# Check the current display server protocol
if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
	paplay /home/josh/battery_sounds/pingy.wav &!
    # Run the Wayland command for KDE
    kscreen-doctor output.eDP-1.rotation.inverted
elif [ "$XDG_SESSION_TYPE" = "x11" ]; then
    # Run the X11 command
    xrandr --output eDP --rotate inverted
else
    notify-send "Rotation Error" "It didn't rotate... Error: SYSTEM-IS-$XDG_SESSION_TYPE" --icon=dialog-warning
    echo "Unknown or unsupported display server: $XDG_SESSION_TYPE" >&2
    exit 1
fi
