v0.1.13 — pacman hook keeps gamescope cap_sys_nice across upgrades
File capabilities live on the inode as a security.capability xattr, so pacman drops cap_sys_nice every time it replaces /usr/bin/gamescope on upgrade. Performance mode silently regresses (worse frame pacing / input latency) with no error surfaced. Installer now drops /usr/share/libalpm/hooks/deckshift-gamescope-cap.hook, which re-applies cap_sys_nice=eip PostTransaction whenever gamescope is installed or upgraded. Idempotent; prompted once at install time alongside the existing cap_sys_nice grant prompt.
This commit is contained in:
parent
a3cb6f28e4
commit
d45f81be36
2 changed files with 53 additions and 6 deletions
|
|
@ -10,6 +10,12 @@ Lineage: forked from [Super-Shift-S-Omarchy-Deck-Mode](https://git.no-signal.uk/
|
||||||
|
|
||||||
## What's New
|
## What's New
|
||||||
|
|
||||||
|
### v0.1.13 — Pacman hook keeps gamescope's cap_sys_nice across upgrades
|
||||||
|
|
||||||
|
- Linux file capabilities live as an xattr (`security.capability`) on the inode, so every time pacman replaces `/usr/bin/gamescope` during an upgrade the previously-granted `cap_sys_nice=eip` is silently lost. Performance mode keeps "working" but the compositor thread loses its priority boost — worse frame pacing and input latency, with no error surfaced anywhere.
|
||||||
|
- DeckShift now installs `/usr/share/libalpm/hooks/deckshift-gamescope-cap.hook`, a pacman hook that re-applies `cap_sys_nice=eip` PostTransaction whenever `gamescope` is installed or upgraded. The installer prompts for it the same time it asks for the initial capability grant; if you already consented on a prior install, re-running `./deckshift.sh` adds the hook silently.
|
||||||
|
- The hook is treated as optional in the verification step, so users who declined performance mode (or declined the cap prompt) won't see a missing-file warning.
|
||||||
|
|
||||||
### v0.1.12 — Refresh-rate selection actually reaches gamescope now
|
### v0.1.12 — Refresh-rate selection actually reaches gamescope now
|
||||||
|
|
||||||
- **The real bug:** Omarchy installs `gamescope` from Arch's `extra` repo (upstream Valve binary), but the AUR `gamescope-session-git` script (OpenGamingCollective / ex-ChimeraOS fork) was written assuming the ChimeraOS-fork `gamescope-plus` binary that ships `--custom-refresh-rates`. The fork isn't packaged for 64-bit Arch — we can't install it cleanly. The session script feature-detects via `gamescope_has_option "--custom-refresh-rates"`, finds it absent, and **silently drops the `CUSTOM_REFRESH_RATES` value before it reaches gamescope**. Net effect: every refresh-rate selection in the DeckShift TUI since the project began has been a no-op. Gaming Mode has been launching at the EDID-preferred mode (usually 60 Hz) regardless of what the user picked. v0.1.8's "60 Hz fix" was correct on paper but never actually reached the binary on Omarchy.
|
- **The real bug:** Omarchy installs `gamescope` from Arch's `extra` repo (upstream Valve binary), but the AUR `gamescope-session-git` script (OpenGamingCollective / ex-ChimeraOS fork) was written assuming the ChimeraOS-fork `gamescope-plus` binary that ships `--custom-refresh-rates`. The fork isn't packaged for 64-bit Arch — we can't install it cleanly. The session script feature-detects via `gamescope_has_option "--custom-refresh-rates"`, finds it absent, and **silently drops the `CUSTOM_REFRESH_RATES` value before it reaches gamescope**. Net effect: every refresh-rate selection in the DeckShift TUI since the project began has been a no-op. Gaming Mode has been launching at the EDID-preferred mode (usually 60 Hz) regardless of what the user picked. v0.1.8's "60 Hz fix" was correct on paper but never actually reached the binary on Omarchy.
|
||||||
|
|
|
||||||
49
deckshift.sh
49
deckshift.sh
|
|
@ -34,7 +34,7 @@ set -Euo pipefail
|
||||||
# -u: Treat unset variables as errors (catches typos in variable names)
|
# -u: Treat unset variables as errors (catches typos in variable names)
|
||||||
# -o pipefail: A pipeline fails if ANY command in it fails, not just the last one
|
# -o pipefail: A pipeline fails if ANY command in it fails, not just the last one
|
||||||
|
|
||||||
DECKSHIFT_VERSION="0.1.12"
|
DECKSHIFT_VERSION="0.1.13"
|
||||||
|
|
||||||
# Resolve the directory this script lives in so we can find sibling files like
|
# Resolve the directory this script lives in so we can find sibling files like
|
||||||
# bin/deckshift-settings and applications/deckshift-settings.desktop when
|
# bin/deckshift-settings and applications/deckshift-settings.desktop when
|
||||||
|
|
@ -1162,24 +1162,64 @@ setup_requirements() {
|
||||||
configure_elephant_launcher
|
configure_elephant_launcher
|
||||||
|
|
||||||
if [[ "${PERFORMANCE_MODE,,}" == "enabled" ]] && command -v gamescope >/dev/null 2>&1; then
|
if [[ "${PERFORMANCE_MODE,,}" == "enabled" ]] && command -v gamescope >/dev/null 2>&1; then
|
||||||
if ! getcap "$(command -v gamescope)" 2>/dev/null | grep -q 'cap_sys_nice'; then
|
local hook_path="/usr/share/libalpm/hooks/deckshift-gamescope-cap.hook"
|
||||||
|
local needs_cap=false
|
||||||
|
getcap "$(command -v gamescope)" 2>/dev/null | grep -q 'cap_sys_nice' || needs_cap=true
|
||||||
|
|
||||||
|
if $needs_cap || ! sudo test -f "$hook_path"; then
|
||||||
echo ""
|
echo ""
|
||||||
echo "================================================================"
|
echo "================================================================"
|
||||||
echo " GAMESCOPE CAPABILITY REQUEST"
|
echo " GAMESCOPE CAPABILITY REQUEST"
|
||||||
echo "================================================================"
|
echo "================================================================"
|
||||||
echo ""
|
echo ""
|
||||||
echo " Performance mode requires granting cap_sys_nice to gamescope."
|
echo " Performance mode needs cap_sys_nice on gamescope (better frame"
|
||||||
|
echo " pacing + lower input latency). Pacman strips file capabilities"
|
||||||
|
echo " on every gamescope upgrade, so DeckShift also installs a pacman"
|
||||||
|
echo " hook that re-applies the cap automatically post-upgrade."
|
||||||
echo ""
|
echo ""
|
||||||
read -p "Grant cap_sys_nice to gamescope? [Y/n]: " -n 1 -r
|
read -p "Grant cap_sys_nice + install pacman hook? [Y/n]: " -n 1 -r
|
||||||
echo
|
echo
|
||||||
if [[ ! $REPLY =~ ^[Nn]$ ]]; then
|
if [[ ! $REPLY =~ ^[Nn]$ ]]; then
|
||||||
|
if $needs_cap; then
|
||||||
sudo setcap 'cap_sys_nice=eip' "$(command -v gamescope)" || warn "Failed to set capability"
|
sudo setcap 'cap_sys_nice=eip' "$(command -v gamescope)" || warn "Failed to set capability"
|
||||||
info "Capability granted to gamescope"
|
info "Capability granted to gamescope"
|
||||||
fi
|
fi
|
||||||
|
install_gamescope_cap_hook
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
install_gamescope_cap_hook
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Pacman strips file capabilities (security.capability xattr) every time it
|
||||||
|
# replaces the gamescope binary on upgrade. Without cap_sys_nice the
|
||||||
|
# compositor thread loses its priority boost and performance mode silently
|
||||||
|
# regresses (no error surfaced). This hook re-applies the cap PostTransaction
|
||||||
|
# whenever gamescope is installed or upgraded. Idempotent — safe to re-run.
|
||||||
|
install_gamescope_cap_hook() {
|
||||||
|
local hook_path="/usr/share/libalpm/hooks/deckshift-gamescope-cap.hook"
|
||||||
|
sudo install -d -m 755 /usr/share/libalpm/hooks
|
||||||
|
sudo tee "$hook_path" > /dev/null << 'HOOK'
|
||||||
|
# Managed by DeckShift — DO NOT EDIT.
|
||||||
|
# Re-applies cap_sys_nice to gamescope after every pacman upgrade. File
|
||||||
|
# capabilities live on the inode as a security.capability xattr and are lost
|
||||||
|
# when pacman replaces the binary.
|
||||||
|
[Trigger]
|
||||||
|
Type = Path
|
||||||
|
Operation = Install
|
||||||
|
Operation = Upgrade
|
||||||
|
Target = usr/bin/gamescope
|
||||||
|
|
||||||
|
[Action]
|
||||||
|
Description = DeckShift: re-applying cap_sys_nice to gamescope
|
||||||
|
When = PostTransaction
|
||||||
|
Exec = /usr/bin/setcap cap_sys_nice=eip /usr/bin/gamescope
|
||||||
|
HOOK
|
||||||
|
sudo chmod 644 "$hook_path"
|
||||||
|
info "Installed pacman hook: $hook_path"
|
||||||
|
}
|
||||||
|
|
||||||
# Optional: install Bluetooth Xbox controller support (xpadneo).
|
# Optional: install Bluetooth Xbox controller support (xpadneo).
|
||||||
# Wired Xbox controllers work without this via the kernel's xpad driver.
|
# Wired Xbox controllers work without this via the kernel's xpad driver.
|
||||||
# xpadneo-dkms gives proper button mapping and rumble for wireless controllers
|
# xpadneo-dkms gives proper button mapping and rumble for wireless controllers
|
||||||
|
|
@ -2902,6 +2942,7 @@ verify_installation() {
|
||||||
["/etc/environment.d/99-shader-cache.conf"]="644:Shader cache config"
|
["/etc/environment.d/99-shader-cache.conf"]="644:Shader cache config"
|
||||||
["/usr/local/bin/deckshift-settings"]="755:Gaming Mode settings TUI"
|
["/usr/local/bin/deckshift-settings"]="755:Gaming Mode settings TUI"
|
||||||
["/usr/share/applications/deckshift-settings.desktop"]="644:Walker launcher for settings TUI"
|
["/usr/share/applications/deckshift-settings.desktop"]="644:Walker launcher for settings TUI"
|
||||||
|
["/usr/share/libalpm/hooks/deckshift-gamescope-cap.hook"]="644:Pacman hook re-applies cap_sys_nice on gamescope upgrade (optional)"
|
||||||
)
|
)
|
||||||
echo " FILE STATUS:"
|
echo " FILE STATUS:"
|
||||||
echo " ------------"
|
echo " ------------"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue