Screenshare: auto-pick game window, remember Vesktop stream audio
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
414b892d60
commit
e6120f821a
3 changed files with 100 additions and 8 deletions
|
|
@ -108,15 +108,36 @@ in
|
|||
# separate hyprpaper daemon.
|
||||
stylix.targets.hyprpaper.enable = false;
|
||||
|
||||
# Screenshare picker: auto-allow restore tokens (the "allow a restore
|
||||
# token" checkbox) so Vesktop/Discord gets a token on the first pick
|
||||
# instead of re-prompting. XDPH parses "[SELECTION]<flags>/..." from the
|
||||
# picker's stdout; flag 'r' = token allowed, so inject it always.
|
||||
# Screenshare picker. allow_token_by_default pre-ticks the "allow a
|
||||
# restore token" box so Vesktop/Discord isn't re-prompted. The custom
|
||||
# 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
|
||||
# "[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.
|
||||
xdg.configFile."hypr/xdph.conf".text = ''
|
||||
screencopy {
|
||||
custom_picker_binary = ${pkgs.writeShellScript "share-picker-auto-restore" ''
|
||||
${pkgs.xdg-desktop-portal-hyprland}/bin/hyprland-share-picker "$@" \
|
||||
| ${pkgs.gnused}/bin/sed 's/^\[SELECTION\]/[SELECTION]r/'
|
||||
allow_token_by_default = true
|
||||
custom_picker_binary = ${pkgs.writeShellScript "share-picker-game-first" ''
|
||||
stamp="''${XDG_RUNTIME_DIR:-/tmp}/xdph-autopick"
|
||||
printf -v now '%(%s)T' -1
|
||||
read -r last 2>/dev/null < "$stamp" || last=0
|
||||
|
||||
game=$(printf '%s' "''${XDPH_WINDOW_SHARING_LIST-}" | ${pkgs.gawk}/bin/awk '
|
||||
BEGIN { RS = "\\[HA>\\]"; FS = "\\[H[CTE]>\\]" }
|
||||
$2 ~ /^steam_app_/ && $3 == "Hearthstone" { hs = $1 }
|
||||
$2 ~ /^steam_app_/ && $3 != "" && !other \
|
||||
&& $3 !~ /^(Battle\.net|Hearthstone Deck Tracker|HearthstoneOverlay)/ { other = $1 }
|
||||
END { print hs != "" ? hs : other }')
|
||||
|
||||
if [ -n "$game" ] && (( now - last > 30 )); then
|
||||
echo "$now" > "$stamp"
|
||||
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