Allow disabling window decorations/controls (#176)

Co-authored-by: Gregory Schier <gschier1990@gmail.com>
This commit is contained in:
Desperate Necromancer
2025-05-17 03:33:59 +07:00
committed by GitHub
parent 432b366105
commit be82b67ed3
17 changed files with 75 additions and 58 deletions

View File

@@ -2,7 +2,6 @@ import { type } from '@tauri-apps/plugin-os';
import { debounce } from '@yaakapp-internal/lib';
import { useEffect, useRef } from 'react';
import { capitalize } from '../lib/capitalize';
import { useOsInfo } from './useOsInfo';
const HOLD_KEYS = ['Shift', 'Control', 'Command', 'Alt', 'Meta'];
@@ -176,13 +175,12 @@ export function useHotKeyLabel(action: HotkeyAction): string {
}
export function useFormattedHotkey(action: HotkeyAction | null): string[] | null {
const osInfo = useOsInfo();
const trigger = action != null ? (hotkeys[action]?.[0] ?? null) : null;
if (trigger == null || osInfo == null) {
if (trigger == null) {
return null;
}
const os = osInfo.osType;
const os = type();
const parts = trigger.split('+');
const labelParts: string[] = [];

View File

@@ -1,5 +0,0 @@
import { type } from '@tauri-apps/plugin-os';
export function useOsInfo() {
return { osType: type() };
}

View File

@@ -1,9 +1,8 @@
import { type } from '@tauri-apps/plugin-os';
import { useIsFullscreen } from './useIsFullscreen';
import { useOsInfo } from './useOsInfo';
export function useStoplightsVisible() {
const platform = useOsInfo();
const fullscreen = useIsFullscreen();
const stoplightsVisible = platform?.osType === 'macos' && !fullscreen;
const stoplightsVisible = type() === 'macos' && !fullscreen;
return stoplightsVisible;
}