Skip to content

Commit

Permalink
feat: Use HHD on both Legion & Ally
Browse files Browse the repository at this point in the history
chore: Further setup script cleanup
fix(legion): Correct rotation on KDE Wayland (Thanks d3Xt3r)
  • Loading branch information
KyleGospo committed Jan 7, 2024
1 parent c335fde commit 030b538
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 18 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -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
22 changes: 8 additions & 14 deletions system_files/desktop/shared/usr/bin/bazzite-hardware-setup
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -164,28 +164,22 @@ 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
systemctl enable --now vpower.service
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
Expand Down
23 changes: 19 additions & 4 deletions system_files/desktop/shared/usr/bin/bazzite-user-setup
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 030b538

Please sign in to comment.