mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 04:01:56 +00:00
Fix setTheme not triggering rerender, improve mac-system-theme example
This commit is contained in:
parent
e5e944475d
commit
37378fb346
3 changed files with 17 additions and 3 deletions
|
|
@ -10,10 +10,13 @@ import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|||
|
||||
function isDarkMode(): boolean {
|
||||
try {
|
||||
execSync("defaults read -g AppleInterfaceStyle", { encoding: "utf-8" });
|
||||
return true; // Returns "Dark" if dark mode
|
||||
const result = execSync(
|
||||
"osascript -e 'tell application \"System Events\" to tell appearance preferences to return dark mode'",
|
||||
{ encoding: "utf-8" },
|
||||
);
|
||||
return result.trim() === "true";
|
||||
} catch {
|
||||
return false; // Throws if light mode
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue