Release OpenScreen 1.4.2
This commit is contained in:
@@ -19,6 +19,7 @@ import {
|
||||
MdVolumeUp,
|
||||
} from "react-icons/md";
|
||||
import { RxDragHandleDots2 } from "react-icons/rx";
|
||||
import { toast } from "sonner";
|
||||
import { useI18n, useScopedT } from "@/contexts/I18nContext";
|
||||
import { getAvailableLocales, getLocaleName } from "@/i18n/loader";
|
||||
import { nativeBridgeClient } from "@/native";
|
||||
@@ -143,7 +144,6 @@ export function LaunchWindow() {
|
||||
top: 12,
|
||||
maxHeight: 240,
|
||||
});
|
||||
const guideCtrlMarkerArmedRef = useRef(false);
|
||||
|
||||
const {
|
||||
devices: micDevices,
|
||||
@@ -248,47 +248,6 @@ export function LaunchWindow() {
|
||||
};
|
||||
}, [isLanguageMenuOpen]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!recording || !guideModeEnabled) {
|
||||
guideCtrlMarkerArmedRef.current = false;
|
||||
return;
|
||||
}
|
||||
|
||||
const isCtrlKey = (event: KeyboardEvent) =>
|
||||
event.key === "Control" || event.code === "ControlLeft" || event.code === "ControlRight";
|
||||
|
||||
const handleKeyDown = (event: KeyboardEvent) => {
|
||||
if (!isCtrlKey(event) || event.repeat || guideCtrlMarkerArmedRef.current) {
|
||||
return;
|
||||
}
|
||||
|
||||
guideCtrlMarkerArmedRef.current = true;
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
addGuideMarker();
|
||||
};
|
||||
|
||||
const releaseCtrlMarker = (event?: KeyboardEvent) => {
|
||||
if (event && !isCtrlKey(event)) {
|
||||
return;
|
||||
}
|
||||
guideCtrlMarkerArmedRef.current = false;
|
||||
};
|
||||
const handleWindowBlur = () => {
|
||||
guideCtrlMarkerArmedRef.current = false;
|
||||
};
|
||||
|
||||
window.addEventListener("keydown", handleKeyDown, { capture: true });
|
||||
window.addEventListener("keyup", releaseCtrlMarker, { capture: true });
|
||||
window.addEventListener("blur", handleWindowBlur);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener("keydown", handleKeyDown, { capture: true });
|
||||
window.removeEventListener("keyup", releaseCtrlMarker, { capture: true });
|
||||
window.removeEventListener("blur", handleWindowBlur);
|
||||
};
|
||||
}, [addGuideMarker, guideModeEnabled, recording]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isLanguageMenuOpen || !languageTriggerRef.current) return;
|
||||
|
||||
@@ -347,6 +306,23 @@ export function LaunchWindow() {
|
||||
setHudMouseEventsEnabled(isLanguageMenuOpen);
|
||||
}, [isLanguageMenuOpen, setHudMouseEventsEnabled]);
|
||||
|
||||
useEffect(() => {
|
||||
const unsubscribe = window.electronAPI?.guide.onMarkerCaptured?.((payload) => {
|
||||
const position =
|
||||
typeof payload.normalizedX === "number" && typeof payload.normalizedY === "number"
|
||||
? `x ${Math.round(payload.normalizedX * 100)}%, y ${Math.round(payload.normalizedY * 100)}%`
|
||||
: undefined;
|
||||
toast.success("Guide event captured", {
|
||||
id: `guide-marker-${payload.eventId}`,
|
||||
description: position,
|
||||
duration: 1400,
|
||||
});
|
||||
});
|
||||
return () => {
|
||||
unsubscribe?.();
|
||||
};
|
||||
}, []);
|
||||
|
||||
const [selectedSource, setSelectedSource] = useState("Screen");
|
||||
const [hasSelectedSource, setHasSelectedSource] = useState(false);
|
||||
const [, setRecordPointerDownCount] = useState(0);
|
||||
|
||||
@@ -11,6 +11,16 @@ interface DesktopSource {
|
||||
thumbnail: string | null;
|
||||
display_id: string;
|
||||
appIcon: string | null;
|
||||
displayId?: number;
|
||||
displayIndex?: number;
|
||||
screenIndex?: number;
|
||||
displayLabel?: string;
|
||||
bounds?: {
|
||||
x: number;
|
||||
y: number;
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
}
|
||||
|
||||
export function SourceSelector() {
|
||||
@@ -39,6 +49,11 @@ export function SourceSelector() {
|
||||
thumbnail: source.thumbnail,
|
||||
display_id: source.display_id,
|
||||
appIcon: source.appIcon,
|
||||
displayId: source.displayId,
|
||||
displayIndex: source.displayIndex,
|
||||
screenIndex: source.screenIndex,
|
||||
displayLabel: source.displayLabel,
|
||||
bounds: source.bounds,
|
||||
})),
|
||||
);
|
||||
} catch (error) {
|
||||
@@ -98,7 +113,14 @@ export function SourceSelector() {
|
||||
{source.appIcon && (
|
||||
<img src={source.appIcon} alt="" className={`${styles.icon} flex-shrink-0`} />
|
||||
)}
|
||||
<div className={`${styles.name} truncate`}>{source.name}</div>
|
||||
<div className="min-w-0">
|
||||
<div className={`${styles.name} truncate`}>{source.name}</div>
|
||||
{source.displayLabel && (
|
||||
<div className="truncate text-[9px] leading-3 text-zinc-500">
|
||||
{source.displayLabel}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user