Screenshare: Vesktop cancel opens full picker, not a 30s window
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e6120f821a
commit
a7c4513d4e
3 changed files with 44 additions and 9 deletions
|
|
@ -114,15 +114,17 @@ 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: share again within 30s (cancel, retry) and the
|
||||
# normal picker shows.
|
||||
# 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.
|
||||
xdg.configFile."hypr/xdph.conf".text = ''
|
||||
screencopy {
|
||||
allow_token_by_default = true
|
||||
custom_picker_binary = ${pkgs.writeShellScript "share-picker-game-first" ''
|
||||
stamp="''${XDG_RUNTIME_DIR:-/tmp}/xdph-autopick"
|
||||
flag="''${XDG_RUNTIME_DIR:-/tmp}/xdph-pick-manually"
|
||||
printf -v now '%(%s)T' -1
|
||||
read -r last 2>/dev/null < "$stamp" || last=0
|
||||
{ cancelled=$(< "$flag"); } 2>/dev/null # no trailing newline, so not `read`
|
||||
echo 0 > "$flag"
|
||||
|
||||
game=$(printf '%s' "''${XDPH_WINDOW_SHARING_LIST-}" | ${pkgs.gawk}/bin/awk '
|
||||
BEGIN { RS = "\\[HA>\\]"; FS = "\\[H[CTE]>\\]" }
|
||||
|
|
@ -131,12 +133,10 @@ in
|
|||
&& $3 !~ /^(Battle\.net|Hearthstone Deck Tracker|HearthstoneOverlay)/ { other = $1 }
|
||||
END { print hs != "" ? hs : other }')
|
||||
|
||||
if [ -n "$game" ] && (( now - last > 30 )); then
|
||||
echo "$now" > "$stamp"
|
||||
if [ -n "$game" ] && (( now - ''${cancelled:-0} > 60 )); then
|
||||
echo "[SELECTION]r/window:$game"
|
||||
exit 0
|
||||
fi
|
||||
echo 0 > "$stamp"
|
||||
exec ${pkgs.xdg-desktop-portal-hyprland}/bin/hyprland-share-picker "$@"
|
||||
''}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue