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
|
|
@ -7,9 +7,14 @@
|
||||||
gamescope
|
gamescope
|
||||||
spotify
|
spotify
|
||||||
# Preselect the last stream's audio source (e.g. Hearthstone) when it's
|
# Preselect the last stream's audio source (e.g. Hearthstone) when it's
|
||||||
# running again, instead of resetting to "None" every Go Live.
|
# running again, instead of resetting to "None" every Go Live; Cancel in
|
||||||
|
# the stream dialog makes the next share show the full window picker
|
||||||
|
# (see xdph.conf in settings/hyprland.nix).
|
||||||
(vesktop.overrideAttrs (old: {
|
(vesktop.overrideAttrs (old: {
|
||||||
patches = (old.patches or [ ]) ++ [ ../patches/vesktop-remember-stream-audio.patch ];
|
patches = (old.patches or [ ]) ++ [
|
||||||
|
../patches/vesktop-remember-stream-audio.patch
|
||||||
|
../patches/vesktop-cancel-shows-picker.patch
|
||||||
|
];
|
||||||
}))
|
}))
|
||||||
lsfg-vk
|
lsfg-vk
|
||||||
lsfg-vk-ui
|
lsfg-vk-ui
|
||||||
|
|
|
||||||
30
patches/vesktop-cancel-shows-picker.patch
Normal file
30
patches/vesktop-cancel-shows-picker.patch
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
--- a/src/main/screenShare.ts
|
||||||
|
+++ b/src/main/screenShare.ts
|
||||||
|
@@ -5,6 +5,8 @@
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { desktopCapturer, session, Streams } from "electron";
|
||||||
|
+import { writeFileSync } from "fs";
|
||||||
|
+import { join } from "path";
|
||||||
|
import type { StreamPick } from "renderer/components/ScreenSharePicker";
|
||||||
|
import { IpcCommands, IpcEvents } from "shared/IpcEvents";
|
||||||
|
|
||||||
|
@@ -55,7 +57,17 @@
|
||||||
|
skipPicker: true
|
||||||
|
}).catch(() => null);
|
||||||
|
|
||||||
|
- if (stream === null) return callback({});
|
||||||
|
+ if (stream === null) {
|
||||||
|
+ // Cancelled: tell the auto-picking XDPH picker (FredOS settings/hyprland.nix)
|
||||||
|
+ // to show the full picker on the next share.
|
||||||
|
+ try {
|
||||||
|
+ writeFileSync(
|
||||||
|
+ join(process.env.XDG_RUNTIME_DIR ?? "/tmp", "xdph-pick-manually"),
|
||||||
|
+ String(Math.floor(Date.now() / 1000))
|
||||||
|
+ );
|
||||||
|
+ } catch {}
|
||||||
|
+ return callback({});
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
callback(video ? { video: sources[0] } : {});
|
||||||
|
|
@ -114,15 +114,17 @@ in
|
||||||
# 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, else any other Proton window (steam_app_*) that isn't a launcher
|
||||||
# or HDT. Escape hatch: share again within 30s (cancel, retry) and the
|
# or HDT. Escape hatch: Cancel in Vesktop's dialog (Gaming's patched
|
||||||
# normal picker shows.
|
# 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 = ''
|
xdg.configFile."hypr/xdph.conf".text = ''
|
||||||
screencopy {
|
screencopy {
|
||||||
allow_token_by_default = true
|
allow_token_by_default = true
|
||||||
custom_picker_binary = ${pkgs.writeShellScript "share-picker-game-first" ''
|
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
|
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 '
|
game=$(printf '%s' "''${XDPH_WINDOW_SHARING_LIST-}" | ${pkgs.gawk}/bin/awk '
|
||||||
BEGIN { RS = "\\[HA>\\]"; FS = "\\[H[CTE]>\\]" }
|
BEGIN { RS = "\\[HA>\\]"; FS = "\\[H[CTE]>\\]" }
|
||||||
|
|
@ -131,12 +133,10 @@ in
|
||||||
&& $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 : other }')
|
||||||
|
|
||||||
if [ -n "$game" ] && (( now - last > 30 )); then
|
if [ -n "$game" ] && (( now - ''${cancelled:-0} > 60 )); then
|
||||||
echo "$now" > "$stamp"
|
|
||||||
echo "[SELECTION]r/window:$game"
|
echo "[SELECTION]r/window:$game"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
echo 0 > "$stamp"
|
|
||||||
exec ${pkgs.xdg-desktop-portal-hyprland}/bin/hyprland-share-picker "$@"
|
exec ${pkgs.xdg-desktop-portal-hyprland}/bin/hyprland-share-picker "$@"
|
||||||
''}
|
''}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue