#!/usr/bin/bash

# Refresh our desktop icons
cp /etc/skel/Desktop/* "$HOME"/Desktop/
chmod +x "$HOME"/Desktop/*

# We need to wait until the display is available before executing our changes
sleep 5

# In the kscreen-doctor commands eDP is used in USB live session but eDP-1 is used post-install, so we need to try both.
# In the edid-decode commands eDP-1 is used in both live session and post-install, so we don't need to change it.
	
# Steam deck screen
if [[ ! -z $(edid-decode /sys/class/drm/card1-eDP-1/edid | grep 'ANX7530 U') ]]; then
	/usr/bin/kscreen-doctor output.eDP.rotation.right
	/usr/bin/kscreen-doctor output.eDP-1.rotation.right
fi

# Lenovo Legion Go screen
if [[ ! -z $(edid-decode /sys/class/drm/card1-eDP-1/edid | grep 'Go Display') ]]; then
        /usr/bin/kscreen-doctor output.eDP.rotation.left
        /usr/bin/kscreen-doctor output.eDP-1.rotation.left
fi
