v0.1.11 — Multi-monitor handling: disable an auxiliary monitor before Gaming Mode
Reported on a Framework Desktop (AMD AI MAX 380) + Gigabyte M27Q +
LG DualUp setup: with both monitors attached, gamescope would either
land on the wrong screen or refuse to start, and writing
OUTPUT_CONNECTOR=DP-X alone wasn't enough to fix it. The workaround
shipped by the user was to manually patch /usr/share/gamescope-session-plus
to disable the other monitor before launching gamescope.
DeckShift now handles this natively, without touching the
gamescope-session-plus script (which is ChimeraOS's, not ours):
- New env var OUTPUT_CONNECTOR_TO_DISABLE (single connector or
comma list) written to ~/.config/environment.d/gamescope-session-plus.conf
alongside the other display keys.
- switch-to-gaming reads it and runs `hyprctl keyword monitor X,disable`
for each listed connector BEFORE the SDDM restart, while Hyprland is
still alive (hyprctl needs a live IPC socket). The disable is
runtime-only — Hyprland's static config isn't touched — so when the
user returns from Gaming Mode the new Hyprland reads its config fresh
and the monitor comes back automatically. No re-enable step needed.
- Settings TUI exposes this as a "Hide monitor" main-menu item. The
picker lists every connected monitor EXCEPT the gaming one (so a
user can't accidentally pick the same connector they just set as
OUTPUT_CONNECTOR) and includes a "(clear)" entry.
Also fixes a latent bug in v0.1.10's config-path shortening:
${CONF/#$HOME/~} was supposed to render the conf path with ~ but
bash applies tilde-expansion to the replacement side, re-expanding ~
to $HOME and making the substitution a no-op. Escaped as \~ now.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
aaa2f3d768
commit
52c883b780
+23
-1
@@ -34,7 +34,7 @@ set -Euo pipefail
|
||||
# -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
|
||||
|
||||
DECKSHIFT_VERSION="0.1.10"
|
||||
DECKSHIFT_VERSION="0.1.11"
|
||||
|
||||
# Resolve the directory this script lives in so we can find sibling files like
|
||||
# bin/deckshift-settings and applications/deckshift-settings.desktop when
|
||||
@@ -2219,6 +2219,28 @@ notify-send -u normal -t 2000 "Gaming Mode" "Switching to Gaming Mode..." 2>/dev
|
||||
pkill -9 gamescope 2>/dev/null || true
|
||||
pkill -9 -f gamescope-session 2>/dev/null || true
|
||||
sleep 1
|
||||
|
||||
# Multi-monitor handling — gamescope-session-plus picks an output by env, but
|
||||
# with two monitors connected it sometimes lands on the wrong one (or refuses
|
||||
# to start). If OUTPUT_CONNECTOR_TO_DISABLE is set in the user's env conf,
|
||||
# disable those connectors via hyprctl while Hyprland is still alive so
|
||||
# gamescope only sees the gaming display. The disable is runtime-only (no
|
||||
# config edit) so when the user returns from Gaming Mode the new Hyprland
|
||||
# reads its static config fresh and the monitor comes back automatically.
|
||||
ENV_CONF="$HOME/.config/environment.d/gamescope-session-plus.conf"
|
||||
if [[ -f "$ENV_CONF" ]]; then
|
||||
TO_DISABLE=$(awk -F= '$1=="OUTPUT_CONNECTOR_TO_DISABLE" { sub(/^[^=]*=/,""); v=$0 } END { print v }' "$ENV_CONF")
|
||||
if [[ -n "$TO_DISABLE" ]]; then
|
||||
IFS=',' read -ra DISABLE_LIST <<< "$TO_DISABLE"
|
||||
for conn in "${DISABLE_LIST[@]}"; do
|
||||
conn="${conn// /}"
|
||||
[[ -z "$conn" ]] && continue
|
||||
hyprctl keyword monitor "${conn},disable" 2>/dev/null || true
|
||||
done
|
||||
sleep 0.5
|
||||
fi
|
||||
fi
|
||||
|
||||
sudo -n chvt 2 2>/dev/null || true
|
||||
sleep 0.3
|
||||
sudo -n systemctl restart sddm
|
||||
|
||||
Reference in New Issue
Block a user