From 030b538a5d30199bd0eaf74f7007c51de32f036a Mon Sep 17 00:00:00 2001 From: Kyle Gospodnetich Date: Sat, 6 Jan 2024 16:20:21 -0800 Subject: [PATCH] feat: Use HHD on both Legion & Ally chore: Further setup script cleanup fix(legion): Correct rotation on KDE Wayland (Thanks d3Xt3r) --- .../usr/libexec/bazzite-enable-steam-patch | 0 .../libexec/bazzite-handle-legion-go-rotation | 28 +++++++++++++++++++ .../shared/usr/bin/bazzite-hardware-setup | 22 ++++++--------- .../desktop/shared/usr/bin/bazzite-user-setup | 23 ++++++++++++--- 4 files changed, 55 insertions(+), 18 deletions(-) delete mode 100755 system_files/deck/shared/usr/libexec/bazzite-enable-steam-patch create mode 100755 system_files/deck/shared/usr/libexec/bazzite-handle-legion-go-rotation diff --git a/system_files/deck/shared/usr/libexec/bazzite-enable-steam-patch b/system_files/deck/shared/usr/libexec/bazzite-enable-steam-patch deleted file mode 100755 index e69de29bb2..0000000000 diff --git a/system_files/deck/shared/usr/libexec/bazzite-handle-legion-go-rotation b/system_files/deck/shared/usr/libexec/bazzite-handle-legion-go-rotation new file mode 100755 index 0000000000..5b2fee248d --- /dev/null +++ b/system_files/deck/shared/usr/libexec/bazzite-handle-legion-go-rotation @@ -0,0 +1,28 @@ +#!/usr/bin/bash + +# This script fixes the screen orientation in the Desktop Mode in Bazzite-Deck KDE +# Author: d3Xt3r + +sleep 1 +echo $(date '+%Y-%m-%d %H:%M:%S') Starting Bazzite Desktop Orientation Fix script...| tee -a /tmp/bazrotfix.log + +# This bit is needed to allow enough time for the desktop to load, otherwise the fix won't work +# Since Steam launches automatically in the Desktop mode in Bazzite-Deck, we can use it +# to determine whether or not the desktop has loaded. +while ! pgrep -x "steam" > /dev/null; do + echo $(date '+%Y-%m-%d %H:%M:%S') Waiting for Steam to start.. | tee -a /tmp/bazrotfix.log + sleep 0.5 +done + +sleep 1 + +# Debug: Get current outputs +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.normal 2>&1 | tee -a /tmp/bazrotfix.log + +echo $(date '+%Y-%m-%d %H:%M:%S') Ending Bazzite Desktop Orientation Fix script >> /tmp/bazrotfix.log +echo -e '\n' >> /tmp/bazrotfix.log diff --git a/system_files/desktop/shared/usr/bin/bazzite-hardware-setup b/system_files/desktop/shared/usr/bin/bazzite-hardware-setup index a326c93ef2..9e0f70e26a 100755 --- a/system_files/desktop/shared/usr/bin/bazzite-hardware-setup +++ b/system_files/desktop/shared/usr/bin/bazzite-hardware-setup @@ -8,7 +8,7 @@ BASE_IMAGE_NAME=$(jq -r '."base-image-name"' < $IMAGE_INFO) FEDORA_VERSION=$(jq -r '."fedora-version"' < $IMAGE_INFO) # SCRIPT VERSION -HWS_VER=19 +HWS_VER=20 HWS_VER_FILE="/etc/bazzite/hws_version" HWS_VER_RAN=$(cat $HWS_VER_FILE) @@ -164,11 +164,7 @@ if [[ $IMAGE_NAME =~ "deck" || $IMAGE_NAME =~ "ally" || $IMAGE_NAME =~ "framegam elif [[ "$(awk '/MemTotal/{print $(NF-1)}' /proc/meminfo)" == "31664740" ]]; then echo "Jupiter with 32GB RAM detected, disabling BIOS updates..." systemctl disable --now jupiter-biosupdate.service - else - echo "Jupiter hardware detected, skipping further setup..." fi - elif [[ ":Galileo:" =~ ":$SYS_ID:" ]]; then - echo "Galileo hardware detected, skipping further setup..." fi systemctl enable --now jupiter-fan-control.service @@ -176,16 +172,14 @@ if [[ $IMAGE_NAME =~ "deck" || $IMAGE_NAME =~ "ally" || $IMAGE_NAME =~ "framegam systemctl --global enable --now sdgyrodsu.service else echo "Generic device detected. Performing setup..." - if [[ ":ROG Ally RC71L_RC71L:AYANEO GEEK:AYANEO 2:AYANEO 2S:AOKZOE A1 AR07:G1618-04:G1619-04:Win600:" =~ ":$SYS_ID:" ]]; then - echo "HandyGCCS supported handheld detected, enabling handycon & TDP control..." - systemctl enable --now handycon.service - sed -i 's/ENABLE_HARDWARE_CONTROL_ON_NON_DECK_HARDWARE=0/ENABLE_HARDWARE_CONTROL_ON_NON_DECK_HARDWARE=1/g' /etc/default/steam-hardware-control - elif [[ ":83E1:" =~ ":$SYS_ID:" ]]; then - echo "Lenovo Legion detected. Swapping to X11 by default. Disabling handycon & TDP control..." + if [[ ":ROG Ally RC71L_RC71L:83E1:" =~ ":$SYS_ID:" ]]; then + echo "HHD supported handheld detected, disabling handycon & ds-inhibit..." systemctl disable --now handycon.service - systemctl disable --now ds-inhibit - sed -i 's/DESKTOP_WAYLAND=true/DESKTOP_WAYLAND=false/g' /etc/default/desktop-wayland - sed -i 's/ENABLE_HARDWARE_CONTROL_ON_NON_DECK_HARDWARE=1/ENABLE_HARDWARE_CONTROL_ON_NON_DECK_HARDWARE=0/g' /etc/default/steam-hardware-control + systemctl disable --now ds-inhibit.service + elif [[ ":AYANEO GEEK:AYANEO 2:AYANEO 2S:AOKZOE A1 AR07:G1618-04:G1619-04:Win600:" =~ ":$SYS_ID:" ]]; then + echo "HandyGCCS supported handheld detected, enabling handycon & ds-inhibit..." + systemctl enable --now handycon.service + systemctl enable --now ds-inhbit.service fi systemctl disable --now jupiter-fan-control.service systemctl disable --now vpower.service diff --git a/system_files/desktop/shared/usr/bin/bazzite-user-setup b/system_files/desktop/shared/usr/bin/bazzite-user-setup index beee36260e..712f9d8800 100755 --- a/system_files/desktop/shared/usr/bin/bazzite-user-setup +++ b/system_files/desktop/shared/usr/bin/bazzite-user-setup @@ -11,7 +11,7 @@ BAZZITE_CONFIG_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/bazzite" mkdir -p "$BAZZITE_CONFIG_DIR" # SCRIPT VERSION -USER_SETUP_VER=19 +USER_SETUP_VER=20 USER_SETUP_VER_FILE="$BAZZITE_CONFIG_DIR/version" USER_SETUP_FEDORA_VER_FILE="$BAZZITE_CONFIG_DIR/fedora_version" @@ -57,7 +57,7 @@ if [[ ! -f "$GRADIENCE_DIR/vgui2.json" ]]; then cp "$THEME_DIR/vgui2.json" "$GRADIENCE_DIR/vgui2.json" fi -if [[ $BASE_IMAGE_NAME =~ "kinoite" ]]; then +if [[ $BASE_IMAGE_NAME =~ "kinoite" ]]; then echo 'Running setup for Kinoite' echo 'Enabling System76-Scheduler KWin script' @@ -85,6 +85,7 @@ else echo 'Running setup for Silverblue on Steam Deck' echo 'Setting up templates' + mkdir -p "$HOME/Templates" if [[ ! -f "$HOME/Templates/vkBasalt.conf" ]]; then ln -s "/etc/vkBasalt.conf" "$HOME/Templates/vkBasalt.conf" fi @@ -104,12 +105,26 @@ else fi fi -# HHD Setup for Lenovo Legion Go +# Deck Build Setup if [[ $IMAGE_NAME =~ "deck" ]]; then - if [[ ":83E1:" =~ ":$SYS_ID:" ]]; then + # HHD Setup + if [[ ":ROG Ally RC71L_RC71L:83E1:" =~ ":$SYS_ID:" ]]; then echo 'Enabling HHD' pkexec /usr/libexec/bazzite-enable-hhd "$USER" fi + + # Legion Rotation Fix + AUTOSTART_FOLDER=${XDG_CONFIG_HOME:-$HOME/.config} + if [[ ":83E1:" =~ ":$SYS_ID" ]] && [[ $BASE_IMAGE_NAME =~ "kinoite" ]]; then + if [[ ! -f "$AUTOSTART_FOLDER/autostart/legionfix" ]]; then + echo 'Adding legion rotation fix' + mkdir -p "$AUTOSTART_FOLDER/autostart" + ln -s "/usr/libexec/bazzite-handle-legion-go-rotation" "$AUTOSTART_FOLDER/autostart/legionfix" + fi + elif [[ -f "$AUTOSTART_FOLDER/autostart/legionfix" ]]; then + echo 'Non-legion or GNOME detected, removing legionfix' + rm -f "$AUTOSTART_FOLDER/autostart/legionfix" + fi fi # Prevent future executions