fix(ally): Correct rotation in KDE

Fixes #680
This commit is contained in:
Kyle Gospodnetich 2024-01-15 17:21:23 -08:00
parent a524faac6d
commit c314aea8fe
2 changed files with 21 additions and 9 deletions

View File

@ -3,6 +3,8 @@
# This script fixes the screen orientation in the Desktop Mode in Bazzite-Deck KDE
# Author: d3Xt3r
SYS_ID="$(cat /sys/devices/virtual/dmi/id/product_name)"
sleep 1
echo $(date '+%Y-%m-%d %H:%M:%S') Starting Bazzite Desktop Orientation Fix script...| tee -a /tmp/bazrotfix.log
@ -28,7 +30,11 @@ kscreen-doctor --outputs 2>&1 | tee -a /tmp/bazrotfix.log
# Fix desktop orientation
# Rotation options: right, normal, left, inverted
echo $(date '+%Y-%m-%d %H:%M:%S') Fixing desktop orientation... | tee -a /tmp/bazrotfix.log
kscreen-doctor output.1.rotation.left 2>&1 | tee -a /tmp/bazrotfix.log
if [[ ":83E1:" =~ ":$SYS_ID" ]]; then
kscreen-doctor output.1.rotation.left 2>&1 | tee -a /tmp/bazrotfix.log
else
kscreen-doctor output.1.rotation.normal 2>&1 | tee -a /tmp/bazrotfix.log
fi
echo $(date '+%Y-%m-%d %H:%M:%S') Ending Bazzite Desktop Orientation Fix script >> /tmp/bazrotfix.log
echo -e '\n' >> /tmp/bazrotfix.log

View File

@ -126,16 +126,22 @@ if [[ $IMAGE_NAME =~ "deck" || $IMAGE_NAME =~ "ally" || $IMAGE_NAME =~ "framegam
# Legion Rotation Fix
AUTOSTART_FOLDER=${XDG_CONFIG_HOME:-$HOME/.config}
if [[ ":83E1:" =~ ":$SYS_ID" ]] && [[ $BASE_IMAGE_NAME =~ "kinoite" ]]; then
if [[ ! -f "$AUTOSTART_FOLDER/autostart/bazzite-handle-legion-go-rotation.desktop" ]]; then
echo 'Adding legion rotation fix'
mkdir -p "$AUTOSTART_FOLDER/autostart"
printf "[Desktop Entry]\nExec=/usr/libexec/bazzite-handle-legion-go-rotation\nIcon=dialog-scripts\nName=bazzite-handle-legion-go-rotation\nType=Application\nX-KDE-AutostartScript=true\n" > "$AUTOSTART_FOLDER/autostart/bazzite-handle-legion-go-rotation.desktop"
fi
elif [[ -f "$AUTOSTART_FOLDER/autostart/bazzite-handle-legion-go-rotation.desktop" ]]; then
echo 'Non-legion or GNOME detected, removing legionfix'
# Remove old legion-only file
if [[ -f "$AUTOSTART_FOLDER/autostart/bazzite-handle-legion-go-rotation.desktop" ]]; then
rm -f "$AUTOSTART_FOLDER/autostart/bazzite-handle-legion-go-rotation.desktop"
fi
if [[ ":ROG Ally RC71L_RC71L:83E1:" =~ ":$SYS_ID" ]] && [[ $BASE_IMAGE_NAME =~ "kinoite" ]]; then
if [[ ! -f "$AUTOSTART_FOLDER/autostart/bazzite-rotation-fix.desktop" ]]; then
echo 'Adding rotation fix'
mkdir -p "$AUTOSTART_FOLDER/autostart"
printf "[Desktop Entry]\nExec=/usr/libexec/bazzite-rotation-fix\nIcon=dialog-scripts\nName=bazzite-rotation-fix\nType=Application\nX-KDE-AutostartScript=true\n" > "$AUTOSTART_FOLDER/autostart/bazzite-rotation-fix.desktop"
fi
elif [[ -f "$AUTOSTART_FOLDER/autostart/bazzite-rotation-fix.desktop" ]]; then
echo 'Non-supported or GNOME detected, removing rotaion fix'
rm -f "$AUTOSTART_FOLDER/autostart/bazzite-rotation-fix.desktop"
fi
fi
# Prevent future executions