From 1cffff77bf186391ffccb73ebde8877ffcac42c4 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 6 Sep 2025 17:26:48 +0300 Subject: [PATCH] fix(client): touch bar triggering on server --- apps/client/src/widgets/react/TouchBar.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/client/src/widgets/react/TouchBar.tsx b/apps/client/src/widgets/react/TouchBar.tsx index 80ba8b37a..215b44f1a 100644 --- a/apps/client/src/widgets/react/TouchBar.tsx +++ b/apps/client/src/widgets/react/TouchBar.tsx @@ -2,7 +2,7 @@ import { useContext, useEffect, useMemo, useState } from "preact/hooks"; import { ParentComponent } from "./react_utils"; import { ComponentChildren, createContext } from "preact"; import { TouchBarItem } from "../../components/touch_bar"; -import { dynamicRequire } from "../../services/utils"; +import { dynamicRequire, isElectron, isMac } from "../../services/utils"; interface TouchBarProps { children: ComponentChildren; @@ -51,6 +51,10 @@ interface TouchBarContextApi { const TouchBarContext = createContext(null); export default function TouchBar({ children }: TouchBarProps) { + if (!isElectron() || !isMac()) { + return; + } + const [ isFocused, setIsFocused ] = useState(false); const parentComponent = useContext(ParentComponent); const remote = dynamicRequire("@electron/remote") as typeof import("@electron/remote");