-
-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(deck): Use new rotation system based on Valve's bootstrap.
- Loading branch information
Showing
10 changed files
with
94 additions
and
69 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
system_files/deck/kinoite/usr/bin/bazzite-plasma-bootstrap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
|
||
# Modified from: | ||
# https://gitlab.com/evlaV/steamdeck-kde-presets/-/blob/master/usr/bin/jupiter-plasma-bootstrap?ref_type=heads | ||
|
||
set -eo pipefail | ||
|
||
SYS_ID="$(cat /sys/devices/virtual/dmi/id/product_name)" | ||
|
||
if [[ "${XDG_SESSION_TYPE}" = "wayland" ]]; then | ||
if /usr/libexec/hardware/needs-left-rotation || /usr/libexec/hardware/needs-right-rotation; then | ||
# Try to wait for kscreen to be ready. This was mostly a hack to try to make the below bug not happen, but I'm afraid | ||
# to remove it because this weird bug has caused hours of grief. | ||
i=0 | ||
while (( ++i < 5 )) && ! kscreen-console outputs; do | ||
sleep 5 | ||
done | ||
|
||
# Then try to fix the config | ||
# | ||
# There is some fun/insane bug where if kscreen hasn't evaluated connected displays yet, doing that at the same time as | ||
# asking it to set the rotation causes it to racily either ignore you, or somehow do two modesets in such a way as to | ||
# break the amdgpu driver and disable the screen for this X11 session. Really. Wayland seems fine. | ||
# | ||
# But if you ask for a nonsense rotation, it will guarantee it has evaluated the new display and added it to the config | ||
# (before failing because foo isn't a rotation). Ha-ha, software! | ||
kscreen-doctor output.eDP-1.rotation.foo || true | ||
kscreen-doctor output.eDP.rotation.foo || true | ||
# In wayland mode the display is named after some EDID identifier and not the output, but "1" works there, and hopefully | ||
# is the internal screen oh boy. | ||
|
||
# Try to wait for kscreen to be ready | ||
i=0 | ||
while (( ++i < 5 )) && ! kscreen-console json; do | ||
sleep 5 | ||
done | ||
|
||
# Then try to fix the config | ||
if /usr/libexec/hardware/needs-right-rotation; then | ||
kscreen-doctor output.eDP.rotation.right \ | ||
|| kscreen-doctor output.eDP-1.rotation.right \ | ||
|| true | ||
elif /usr/libexec/hardware/needs-left-rotation; then | ||
kscreen-doctor output.eDP.rotation.left \ | ||
|| kscreen-doctor output.eDP-1.rotation.left \ | ||
|| true | ||
fi | ||
fi | ||
fi |
16 changes: 16 additions & 0 deletions
16
system_files/deck/kinoite/usr/etc/xdg/autostart/bazzite-plasma-bootstrap.desktop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[Desktop Entry] | ||
Exec=/usr/bin/bazzite-plasma-bootstrap | ||
GenericName[en_US]=Desktop Bootstrap | ||
GenericName=Desktop Bootstrap | ||
Icon=system-run | ||
MimeType= | ||
Name[en_US]=Desktop Bootstrap | ||
Name=Desktop Bootstrap | ||
Path= | ||
StartupNotify=true | ||
Terminal=false | ||
Type=Application | ||
X-DBUS-ServiceName= | ||
X-DBUS-StartupType= | ||
X-KDE-SubstituteUID=false | ||
X-KDE-Username= |
46 changes: 0 additions & 46 deletions
46
system_files/deck/kinoite/usr/libexec/bazzite-rotation-fix
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
system_files/deck/kinoite/usr/libexec/hardware/needs-left-rotation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/bash | ||
|
||
SYS_ID="$(cat /sys/devices/virtual/dmi/id/product_name)" | ||
|
||
# Legion Go | ||
# Loki Max | ||
# AYANEO Air Plus | ||
if [[ ":83E1:Loki Max:AIR Plus:" =~ ":$SYS_ID:" ]]; then | ||
exit 0 | ||
fi | ||
|
||
exit 1 |
8 changes: 8 additions & 0 deletions
8
system_files/deck/kinoite/usr/libexec/hardware/needs-right-rotation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/bash | ||
|
||
# Steam Deck | ||
if /usr/libexec/hardware/valve-hardware; then | ||
exit 0 | ||
fi | ||
|
||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
system_files/desktop/shared/usr/libexec/hardware/rotation-fix-hardware
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters