Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
Add click-to-lock window selection & onClose
Richie McIlroy43ec4e36a93c
diff --git a/apps/desktop/src/routes/target-select-overlay.tsx b/apps/desktop/src/routes/target-select-overlay.tsxindex 9fb5e7216..5c2a7e967 100644--- a/apps/desktop/src/routes/target-select-overlay.tsx+++ b/apps/desktop/src/routes/target-select-overlay.tsx@@ -332,6 +332,10 @@ function Inner() {<RecordingControlstarget={{ variant: "cameraOnly" } as ScreenCaptureTarget}showBackground+ onClose={() => {+ setOptions("targetMode", null);+ commands.closeTargetSelectOverlays();+ }}/></div></Match>@@ -378,6 +382,10 @@ function Inner() {<RecordingControlssetToggleModeSelect={setToggleModeSelect}target={{ variant: "display", id: displayId() }}+ onClose={() => {+ setOptions("targetMode", null);+ commands.closeTargetSelectOverlays();+ }}/><ShowCapFreeWarning isInstantMode={options.mode === "instant"} /></div>@@ -407,6 +415,14 @@ function Inner() {() => selectedWindow() ?? targetUnderCursor.window,);+ createEffect(() => {+ const selected = selectedWindow();+ const icon = windowIcon.data;+ if (selected && icon && !lockedIcon()) {+ setLockedIcon(icon);+ }+ });+onMount(async () => {try {const win = await WebviewWindow.getByLabel("camera");@@ -476,6 +492,34 @@ function Inner() {<divdata-over={targetUnderCursor.display_id === params.displayId}class="relative w-screen h-screen bg-black/70"+ onClick={() => {+ const current = selectedWindow();+ const hovered = targetUnderCursor.window;+ if (current && hovered && hovered.id !== current.id) {+ setLockedIcon(windowIcon.data ?? null);+ setSelectedWindow({+ id: hovered.id,+ bounds: {+ position: {+ x: hovered.bounds.position.x,+ y: hovered.bounds.position.y,+ },+ size: {+ width: hovered.bounds.size.width,+ height: hovered.bounds.size.height,+ },+ },+ app_name: hovered.app_name,+ });+ setOptions(+ "captureTarget",+ reconcile({+ variant: "window",+ id: hovered.id,+ }),+ );+ }+ }}><divclass="flex absolute flex-col justify-center items-center bg-blue-600/40"@@ -486,7 +530,9 @@ function Inner() {top: `${windowUnderCursor.bounds.position.y}px`,}}onClick={() => {- if (!selectedWindow()) {+ const current = selectedWindow();+ const hovered = targetUnderCursor.window;+ if (!current) {setOriginalCameraBounds(null);setLockedIcon(windowIcon.data ?? null);setSelectedWindow({@@ -510,6 +556,29 @@ function Inner() {id: windowUnderCursor.id,}),);+ } else if (hovered && hovered.id !== current.id) {+ setLockedIcon(windowIcon.data ?? null);+ setSelectedWindow({+ id: hovered.id,+ bounds: {+ position: {+ x: hovered.bounds.position.x,+ y: hovered.bounds.position.y,+ },+ size: {+ width: hovered.bounds.size.width,+ height: hovered.bounds.size.height,+ },+ },+ app_name: hovered.app_name,+ });+ setOptions(+ "captureTarget",+ reconcile({+ variant: "window",+ id: hovered.id,+ }),+ );}}}>@@ -518,7 +587,9 @@ function Inner() {<Suspense><Showwhen={- selectedWindow() ? lockedIcon() : windowIcon.data+ selectedWindow()+ ? (lockedIcon() ?? windowIcon.data)+ : windowIcon.data}>{(icon) => (@@ -549,6 +620,12 @@ function Inner() {setOptions("targetMode", null);commands.closeTargetSelectOverlays();}}+ onClose={() => {+ setSelectedWindow(null);+ setLockedIcon(null);+ setOptions("targetMode", null);+ commands.closeTargetSelectOverlays();+ }}/></div>@@ -1038,6 +1115,10 @@ function Inner() {disabled={!isValid()}showBackground={controllerInside()}onRecordingStart={() => setOriginalCameraBounds(null)}+ onClose={() => {+ setOptions("targetMode", null);+ commands.closeTargetSelectOverlays();+ }}/></Show><Show when={!isValid()}>@@ -1472,6 +1553,7 @@ function RecordingControls(props: {showBackground?: boolean;disabled?: boolean;onRecordingStart?: () => void;+ onClose?: () => void;}) {const auth = authStore.createQuery();const { setOptions, rawOptions } = useRecordingOptions();@@ -1612,8 +1694,12 @@ function RecordingControls(props: {<div class="flex gap-2.5 items-center"><divonClick={() => {- setOptions("targetMode", null);- commands.closeTargetSelectOverlays();+ if (props.onClose) {+ props.onClose();+ } else {+ setOptions("targetMode", null);+ commands.closeTargetSelectOverlays();+ }}}class="flex justify-center items-center rounded-full transition-opacity bg-gray-12 size-9 hover:opacity-80">