Handy/src/hooks/useOsType.ts
CJ Pais b733ccc458
init attempt at new kb (#580)
* init attempt at new kb

* 0.1.1 handy-keys

* format

* cleanup

* support for capslock/shiftlock?

* move kb to experimental

* use hook

* fix macos bug

* attempt mouse buttons as well
2026-01-20 08:23:35 +08:00

16 lines
525 B
TypeScript

import { type } from "@tauri-apps/plugin-os";
import { type OSType } from "../lib/utils/keyboard";
/**
* Get the current OS type for keyboard handling.
* This is a simple wrapper - type() is synchronous.
*/
export function useOsType(): OSType {
const osType = type();
// type() returns "macos" | "windows" | "linux" | "ios" | "android"
// OSType expects "macos" | "windows" | "linux" | "unknown"
if (osType === "macos" || osType === "windows" || osType === "linux") {
return osType;
}
return "unknown";
}