mirror of
https://github.com/theupriser/steamify-cachyos.git
synced 2026-10-13 20:35:40 +02:00
NVIDIA setup: preflight (pacman lock, free space), failure marker with notification, reminder in the menu
Sync git.upriser.nl mirror / sync (push) Skipped
Sync git.upriser.nl mirror / sync (push) Skipped
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KkpbsMw4rQyBsxDG6ebHK2
This commit is contained in:
1 parent
89a66f3159
commit
b112082704
2 files changed
+31
-1
No files matched your search
+30
-1
@@ -249,9 +249,37 @@ gsn_display_disable() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gsn_preflight() {
|
||||||
|
# Before anything changes: what would make the install fail half way. Prints the reason and fails, or passes.
|
||||||
|
if [[ -e /var/lib/pacman/db.lck ]]; then
|
||||||
|
echo "another package manager is running (/var/lib/pacman/db.lck): finish or close it and try again"; return 1
|
||||||
|
fi
|
||||||
|
local free; free="$(df --output=avail -BM / 2>/dev/null | tail -1 | tr -dc 0-9)"
|
||||||
|
if [[ -n "$free" ]] && (( free < 1500 )); then
|
||||||
|
echo "less than 1.5 GB free on /: free some space and try again"; return 1
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
gsn_fail_mark() {
|
||||||
|
# Remember a failed setup so the menu says so on the next start, and tell the user now (desktop notification).
|
||||||
|
state_set gamescope_nvidia failed "$(date '+%Y-%m-%d %H:%M'): $1"
|
||||||
|
command -v notify-send >/dev/null 2>&1 &&
|
||||||
|
notify-send -a Steamify -i dialog-warning "Steamify: gaming mode setup failed" "$1. Open Steamify and apply again." 2>/dev/null || true
|
||||||
|
}
|
||||||
|
|
||||||
|
gsn_fail_note() {
|
||||||
|
# The menu's reminder of a failed setup (nothing when the last one worked).
|
||||||
|
local f; f="$(state_get gamescope_nvidia failed)"
|
||||||
|
[[ -n "$f" ]] && warn "The last gaming mode setup for NVIDIA failed ($f). Apply the conversion again to retry."
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
gsn_enable() {
|
gsn_enable() {
|
||||||
# Only on a supported NVIDIA card; elsewhere the stock gamescope is right.
|
# Only on a supported NVIDIA card; elsewhere the stock gamescope is right.
|
||||||
nvidia_present || return 0
|
nvidia_present || return 0
|
||||||
|
local why
|
||||||
|
if ! why="$(gsn_preflight)"; then err "Gaming mode for NVIDIA can't be set up: $why."; gsn_fail_mark "$why"; return 1; fi
|
||||||
# A PC that had "Gaming on NVIDIA" on: Steam must not also start on the desktop.
|
# A PC that had "Gaming on NVIDIA" on: Steam must not also start on the desktop.
|
||||||
nvidia_swap_out
|
nvidia_swap_out
|
||||||
# What NVIDIA's DRM stack wants (lib/nvidia.sh; a supported card only, the functions check): modeset/fbdev on the
|
# What NVIDIA's DRM stack wants (lib/nvidia.sh; a supported card only, the functions check): modeset/fbdev on the
|
||||||
@@ -259,7 +287,8 @@ gsn_enable() {
|
|||||||
# effect at the next boot, like the session.
|
# effect at the next boot, like the session.
|
||||||
nvidia_kernel_enable || return 1
|
nvidia_kernel_enable || return 1
|
||||||
nvidia_extras_enable || return 1
|
nvidia_extras_enable || return 1
|
||||||
gsn_install_package || return 1
|
gsn_install_package || { gsn_fail_mark "the patched gamescope couldn't be installed"; return 1; }
|
||||||
|
state_set gamescope_nvidia failed ""
|
||||||
gsn_env_enable
|
gsn_env_enable
|
||||||
gsn_display_enable || warn "Couldn't set up the display mode for gaming mode: gamescope takes the display's preferred mode."
|
gsn_display_enable || warn "Couldn't set up the display mode for gaming mode: gamescope takes the display's preferred mode."
|
||||||
ok "gamescope draws NVIDIA's picture through GBM (gamescope_drm_gbm_scanout=1) from the next gaming mode start."
|
ok "gamescope draws NVIDIA's picture through GBM (gamescope_drm_gbm_scanout=1) from the next gaming mode start."
|
||||||
|
|||||||
@@ -337,6 +337,7 @@ toggle_component() {
|
|||||||
show_menu() {
|
show_menu() {
|
||||||
local i=0 c now want
|
local i=0 c now want
|
||||||
echo
|
echo
|
||||||
|
gsn_fail_note
|
||||||
printf " ${c_bold}%-3s %-6s %-6s %s${c_reset}\n" "#" "Now" "Want" "Component"
|
printf " ${c_bold}%-3s %-6s %-6s %s${c_reset}\n" "#" "Now" "Want" "Component"
|
||||||
MENU_ITEMS=()
|
MENU_ITEMS=()
|
||||||
for c in "${COMPONENTS[@]}"; do
|
for c in "${COMPONENTS[@]}"; do
|
||||||
|
|||||||
Reference in new issue
Block a user