Screenshare: auto-pick gamescope windows

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-15 21:00:21 +01:00
parent 08b25d3241
commit 3f4ee2579b

View file

@ -118,10 +118,10 @@ in
# picker skips the dialog when a game is open: XDPH hands it the window # picker skips the dialog when a game is open: XDPH hands it the window
# list as id[HC>]class[HT>]title[HE>]address[HA>]… and reads back # list as id[HC>]class[HT>]title[HE>]address[HA>]… and reads back
# "[SELECTION]<flags>/window:<id>" (flag r = token allowed). Hearthstone # "[SELECTION]<flags>/window:<id>" (flag r = token allowed). Hearthstone
# wins, else any other Proton window (steam_app_*) that isn't a launcher # wins, then a nested gamescope window, then any other Proton window
# or HDT. Gaming's patched Vesktop writes the time to xdph-pick-manually # (steam_app_*) that isn't a launcher or HDT. Gaming's patched Vesktop
# right before asking the portal ("Pick Another Window", shift-click) # writes the time to xdph-pick-manually right before asking the portal
# to get the normal picker instead. # ("Pick Another Window", shift-click) to get the normal picker instead.
# #
# After answering, it grim-shots the selection to xdph-preview.jpg for # After answering, it grim-shots the selection to xdph-preview.jpg for
# Vesktop's dialog (~70ms vs Electron's ~1s PipeWire thumbnail). grim # Vesktop's dialog (~70ms vs Electron's ~1s PipeWire thumbnail). grim
@ -154,9 +154,10 @@ in
} }
game=$(entries "" ' game=$(entries "" '
$2 ~ /^steam_app_/ && $3 == "Hearthstone" { hs = $1 } $2 ~ /^steam_app_/ && $3 == "Hearthstone" { hs = $1 }
$2 == "gamescope" && !gs { gs = $1 }
$2 ~ /^steam_app_/ && $3 != "" && !other \ $2 ~ /^steam_app_/ && $3 != "" && !other \
&& $3 !~ /^(Battle\.net|Hearthstone Deck Tracker|HearthstoneOverlay)/ { other = $1 } && $3 !~ /^(Battle\.net|Hearthstone Deck Tracker|HearthstoneOverlay)/ { other = $1 }
END { print hs != "" ? hs : other }') END { print hs != "" ? hs : gs != "" ? gs : other }')
if [ -n "$game" ] && (( now - forced > 10 )); then if [ -n "$game" ] && (( now - forced > 10 )); then
selection=r/window:$game selection=r/window:$game