Skip to content

Commit a7af503

Browse files
committed
feat: Add hhd for Lenovo Legion
1 parent f47dc5f commit a7af503

File tree

6 files changed

+47
-8
lines changed

6 files changed

+47
-8
lines changed

Containerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,7 @@ RUN rpm-ostree install \
467467
galileo-mura \
468468
powerbuttond \
469469
HandyGCCS \
470+
hhd \
470471
vpower \
471472
ds-inhibit \
472473
steam_notif_daemon \
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
systemctl enable --now hhd@$(systemd-escape $1).service
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE policyconfig PUBLIC
3+
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
4+
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
5+
<policyconfig>
6+
7+
<vendor>Bazzite</vendor>
8+
<vendor_url>https://github.com/ublue-os/bazzite/</vendor_url>
9+
10+
<action id="org.bazzite.hhd.pkexec">
11+
<description>Handheld Daemon is a project that aims to provide utilities for managing handheld devices</description>
12+
<icon_name>package-x-generic</icon_name>
13+
<defaults>
14+
<allow_any>yes</allow_any>
15+
<allow_inactive>yes</allow_inactive>
16+
<allow_active>yes</allow_active>
17+
</defaults>
18+
<annotate key="org.freedesktop.policykit.exec.path">/usr/libexec/bazzite-enable-hhd</annotate>
19+
</action>
20+
21+
</policyconfig>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
polkit.addRule(function(action, subject) {
2+
if (action.id == "org.bazzite.hhd.pkexec" &&
3+
subject.isInGroup("wheel")) {
4+
return polkit.Result.YES;
5+
}
6+
});

system_files/desktop/shared/usr/bin/bazzite-hardware-setup

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ BASE_IMAGE_NAME=$(jq -r '."base-image-name"' < $IMAGE_INFO)
77
FEDORA_VERSION=$(jq -r '."fedora-version"' < $IMAGE_INFO)
88

99
# SCRIPT VERSION
10-
HWS_VER=17
10+
HWS_VER=18
1111
HWS_VER_FILE="/etc/bazzite/hws_version"
1212
HWS_VER_RAN=$(cat $HWS_VER_FILE)
1313

@@ -173,10 +173,15 @@ if [[ $IMAGE_NAME =~ "deck" || $IMAGE_NAME =~ "ally" || $IMAGE_NAME =~ "framegam
173173
systemctl --global enable --now sdgyrodsu.service
174174
else
175175
echo "Generic device detected. Performing setup..."
176-
if [[ ":ROG Ally RC71L_RC71L:AYANEO GEEK:AYANEO 2:AYANEO 2S:AOKZOE A1 AR07:G1618-04:G1619-04:83E1:" =~ ":$SYS_ID:" ]]; then
176+
if [[ ":ROG Ally RC71L_RC71L:AYANEO GEEK:AYANEO 2:AYANEO 2S:AOKZOE A1 AR07:G1618-04:G1619-04:" =~ ":$SYS_ID:" ]]; then
177177
echo "HandyGCCS supported handheld detected, enabling handycon & TDP control..."
178178
systemctl enable --now handycon.service
179179
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
180+
elif [[ ":83E1:" =~ ":$SYS_ID:" ]]; then
181+
echo "Lenovo Legion detected. Swapping to X11 by default. Disabling handycon & TDP control..."
182+
systemctl disable --now handycon.service
183+
sed -i 's/DESKTOP_WAYLAND=true/DESKTOP_WAYLAND=false/g' /etc/desktop-wayland
184+
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
180185
fi
181186
systemctl disable --now jupiter-fan-control.service
182187
systemctl disable --now vpower.service
@@ -185,11 +190,6 @@ if [[ $IMAGE_NAME =~ "deck" || $IMAGE_NAME =~ "ally" || $IMAGE_NAME =~ "framegam
185190
systemctl disable --now ryzenadj.service
186191
systemctl disable --now batterylimit.service
187192
systemctl --global disable --now sdgyrodsu.service
188-
189-
if [[ ":83E1:" =~ ":$SYS_ID:" ]]; then
190-
echo "Lenovo Legion detected. Swapping to X11 by default."
191-
sed -i 's/DESKTOP_WAYLAND=true/DESKTOP_WAYLAND=false/g' /etc/desktop-wayland
192-
fi
193193
fi
194194
fi
195195

system_files/desktop/shared/usr/bin/bazzite-user-setup

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ FEDORA_VERSION=$(jq -r '."fedora-version"' < $IMAGE_INFO)
77
SYS_ID="$(cat /sys/devices/virtual/dmi/id/product_name)"
88

99
# SCRIPT VERSION
10-
USER_SETUP_VER=18
10+
USER_SETUP_VER=19
1111
USER_SETUP_VER_FILE="$HOME/.bazzite-configured"
1212
USER_SETUP_VER_RAN=$(cat $USER_SETUP_VER_FILE)
1313
USER_SETUP_FEDORA_VER_FILE="$HOME/.bazzite-configured-fedora-version"
@@ -84,6 +84,14 @@ else
8484
fi
8585
fi
8686

87+
# HHD Setup for Lenovo Legion Go
88+
if [[ $IMAGE_NAME =~ "deck" ]]; then
89+
if [[ ":83E1:" =~ ":$SYS_ID:" ]]; then
90+
echo 'Enabling HHD'
91+
pkexec /usr/libexec/bazzite-enable-hhd "$USER"
92+
fi
93+
fi
94+
8795
# Previous images used Bazzite-Arch to run Steam, Lutris, and Protontricks on desktop images
8896
if [[ -f "$HOME/.local/share/applications/bazzite-arch-steam.desktop" ]]; then
8997
rm -f "$HOME/.local/share/applications/bazzite-arch-steam.desktop"

0 commit comments

Comments
 (0)