Vesktop: Pick Another Window button + shift-click for full picker

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-12 20:19:45 +01:00
parent a7c4513d4e
commit 2eeb29ac80
4 changed files with 140 additions and 39 deletions

View file

@ -114,16 +114,16 @@ in
# list as id[HC>]class[HT>]title[HE>]address[HA>]… and reads back
# "[SELECTION]<flags>/window:<id>" (flag r = token allowed). Hearthstone
# wins, else any other Proton window (steam_app_*) that isn't a launcher
# or HDT. Escape hatch: Cancel in Vesktop's dialog (Gaming's patched
# Vesktop writes the time to xdph-pick-manually) and the next share
# within a minute shows the normal picker.
# or HDT. Gaming's patched Vesktop writes the time to xdph-pick-manually
# right before asking the portal ("Pick Another Window", shift-click)
# to get the normal picker instead.
xdg.configFile."hypr/xdph.conf".text = ''
screencopy {
allow_token_by_default = true
custom_picker_binary = ${pkgs.writeShellScript "share-picker-game-first" ''
flag="''${XDG_RUNTIME_DIR:-/tmp}/xdph-pick-manually"
printf -v now '%(%s)T' -1
{ cancelled=$(< "$flag"); } 2>/dev/null # no trailing newline, so not `read`
{ forced=$(< "$flag"); } 2>/dev/null # no trailing newline, so not `read`
echo 0 > "$flag"
game=$(printf '%s' "''${XDPH_WINDOW_SHARING_LIST-}" | ${pkgs.gawk}/bin/awk '
@ -133,7 +133,7 @@ in
&& $3 !~ /^(Battle\.net|Hearthstone Deck Tracker|HearthstoneOverlay)/ { other = $1 }
END { print hs != "" ? hs : other }')
if [ -n "$game" ] && (( now - ''${cancelled:-0} > 60 )); then
if [ -n "$game" ] && (( now - ''${forced:-0} > 10 )); then
echo "[SELECTION]r/window:$game"
exit 0
fi