#!/bin/bash

if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
    pw-play /home/josh/battery_sounds/Impact/hit1.mp3
    kscreen-doctor output.eDP-1.rotation.right
    pw-play /home/josh/battery_sounds/Impact/hit2.mp3
    kscreen-doctor output.eDP-1.rotation.inverted
    pw-play /home/josh/battery_sounds/Impact/hit3.mp3
    kscreen-doctor output.eDP-1.rotation.left
    pw-play /home/josh/battery_sounds/Impact/hit4.mp3
    kscreen-doctor output.eDP-1.rotation.none

    notify-send "Did a barrel roll successfully!" "ChromeOS has nothing on this." --icon=dialog-warning
else
    notify-send "Failed to do a barrel roll" "Might as well reinstall ChromeOS at this point...Error: SYSTEM-IS-$XDG_SESSION_TYPE" --icon=dialog-warning
    echo "Failed to do a barrel roll: $XDG_SESSION_TYPE" >&2
    exit 1
fi
