fix(steam): Add shortcut to start Steam BPM without slugishness (#1754)

* Revert "chore: Kill X11 session for good"

This reverts commit b7ee250370c2fe7e4f6283357d2326237e6eb5e6.

* fix(legion go): remove lcd script (#1745)

It was not meant to be...

* fix(steam): Add shortcut to start Steam BPM without slugishness

This adds a script that stops Steam gracefully to later on start it directly in Big Picture mode.
This serves as workaround for issue #1675

* chore(steam): Remove steam bpm shortcut from deck images

---------

Co-authored-by: Kyle Gospodnetich <me@kylegospodneti.ch>
Co-authored-by: Antheas Kapenekakis <5252246+antheas@users.noreply.github.com>
This commit is contained in:
Zeglius 2024-10-21 18:33:24 +02:00 committed by GitHub
parent ae9416050c
commit bc883a4610
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 85 additions and 48 deletions

View File

@ -893,6 +893,8 @@ RUN /usr/libexec/containerbuild/image-info && \
echo "Compiling gschema to include Bazzite Deck setting overrides" && \
glib-compile-schemas /usr/share/glib-2.0/schemas &>/dev/null && \
rm -r /tmp/bazzite-schema-test && \
echo "Removing Steam BPM workaround .desktop file" && \
{ rm -v /usr/share/applications/bazzite-steam-bpm.desktop || true; } && \
systemctl enable bazzite-autologin.service && \
systemctl enable wireplumber-workaround.service && \
systemctl enable wireplumber-sysconf.service && \
@ -936,11 +938,16 @@ ARG VERSION_PRETTY="${VERSION_PRETTY}"
COPY system_files/nvidia/shared system_files/nvidia/${BASE_IMAGE_NAME} /
# Remove everything that doesn't work well with NVIDIA
# Install X11 session (Remove me for Fedora 41)
RUN --mount=type=cache,dst=/var/cache/rpm-ostree \
rpm-ostree override remove \
rocm-hip \
rocm-opencl \
rocm-clinfo && \
if [[ "${BASE_IMAGE_NAME}" == "kinoite" && "$FEDORA_MAJOR_VERSION" -eq "40" ]]; then \
rpm-ostree install \
plasma-workspace-x11 \
; fi && \
/usr/libexec/containerbuild/cleanup.sh && \
ostree container commit

View File

@ -1,48 +0,0 @@
gamescope.config.known_displays.lenovo_legiongo_lcd = {
pretty_name = "Lenovo Legion Go LCD",
dynamic_refresh_rates = {
60,
125, 126, 127, 128, 129,
130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
140, 141, 142, 143, 144
},
hdr = {
-- Setup some fallbacks for undocking with HDR, meant
-- for the internal panel. It does not support HDR.
supported = false,
force_enabled = false,
eotf = gamescope.eotf.gamma22,
max_content_light_level = 500,
max_frame_average_luminance = 500,
min_content_light_level = 0.5
},
-- Use the EDID colorimetry for now, but someone should check
-- if the EDID colorimetry truly matches what the display is capable of.
dynamic_modegen = function(base_mode, refresh)
debug("Generating mode "..refresh.."Hz for Lenovo Legion Go LCD")
local mode = base_mode
-- These are only tuned for 1600x2560
gamescope.modegen.set_resolution(mode, 1600, 2560)
-- Horizontal timings: Hfront, Hsync, Hback
gamescope.modegen.set_h_timings(mode, 60, 30, 130)
-- Vertical timings: Vfront, Vsync, Vback
gamescope.modegen.set_v_timings(mode, 30, 4, 96)
mode.clock = gamescope.modegen.calc_max_clock(mode, refresh)
mode.vrefresh = gamescope.modegen.calc_vrefresh(mode)
return mode
end,
matches = function(display)
-- There is only a single panel in use on Lenovo Legion Go devices.
if display.vendor == "LEN" and display.model == "Go Display" and display.product == 0x0001 then
debug("[lenovo_legiongo_lcd] Matched vendor: "..display.vendor.." model: "..display.model.." product: "..display.product)
return 5000
end
return -1
end
}
debug("Registered Lenovo Legion Go LCD as a known display")
--debug(inspect(gamescope.config.known_displays.lenovo_legiongo_lcd))

View File

@ -0,0 +1,71 @@
#!/usr/bin/bash
# Stop Steam client and it in Big Picture Mode
#
# This is a workaround for Big Picture Mode running slugish when switching from
# desktop mode to BPM from the client. See https://github.com/ublue-os/bazzite/issues/1675
# TODO 20/10/2024: Remove me whenever the issue above gets solved
# Check if we are running from a terminal or from a .desktop shortcut
if ((SHLVL > 1)); then
function echoerr() {
echo >&2 "$@"
}
else
function echoerr() {
zenity --error --icon=bazzite-logo --text="$*"
}
fi
STEAM_BIN=/usr/bin/steam
BAZZITE_STEAM_BIN="/usr/bin/bazzite-steam"
# BAZZITE_STEAM_BIN="$(type -P bazzite-steam)"
STEAM_DIR="${HOME}/.local/share/Steam"
TIMEOUT_SECS=30
# List of binaries to check with lsof to prove steam is running
BIN_WATCH=(
"${STEAM_BIN}"
"${BAZZITE_STEAM_BIN}"
"${STEAM_DIR}/steam.sh"
"${STEAM_DIR}"/ubuntu*/steam
)
# Echo pids of steam processes
function get_steam_pids() {
lsof -t -- "${BIN_WATCH[@]}" 2>/dev/null || true
}
# Return err if steam is not running
function is_steam_running() {
(($(get_steam_pids | wc --lines) > 0))
return
}
function main() {
# Check if steam is running
if is_steam_running; then
# Stop it
${STEAM_BIN} +quit
# Wait to be fully stopped
# shellcheck disable=SC2046
if ! waitpid --exited --timeout ${TIMEOUT_SECS} $(get_steam_pids); then
# Check if we timed out
local err=$?
if ((err == 3)); then
echoerr "ERROR: Timed out stopping Steam. Stopping script..."
exit 1
else # Something else happened
echoerr "ERROR: code=${err}; This is strange..."
exit ${err}
fi
fi
fi
# Start steam in big picture mode
${BAZZITE_STEAM_BIN} steam://open/bigpicture "$@"
}
main "$@"

View File

@ -0,0 +1,7 @@
[Desktop Entry]
Name=Steam Big Picture Mode
Exec=/usr/bin/bazzite-steam-bpm %U
Icon=steam
Terminal=false
Type=Application
Categories=Network;FileTransfer;Game;