F11 funkar i webbläsaren

This commit is contained in:
botvid johansson 2025-02-11 08:03:31 +01:00
parent b23f0e299a
commit 7de2df6ad0

View File

@ -1,4 +1,5 @@
import { goto } from '$app/navigation'; import { goto } from '$app/navigation';
import { PUBLIC_TAURI } from '$env/static/public';
import type { ExpanderType } from "./index.d.ts"; import type { ExpanderType } from "./index.d.ts";
import { getCurrentWindow } from "@tauri-apps/api/window"; import { getCurrentWindow } from "@tauri-apps/api/window";
import { incTextSize, decTextSize, selectNextColor, toggleMenuOpen, appState } from "$lib/stores.svelte" import { incTextSize, decTextSize, selectNextColor, toggleMenuOpen, appState } from "$lib/stores.svelte"
@ -136,8 +137,10 @@ hotkeys.set("F2", {
hotkeys.set("F11", { hotkeys.set("F11", {
action: (e) => { action: (e) => {
e.preventDefault()
console.log("Toggle fullscreen") console.log("Toggle fullscreen")
console.log(PUBLIC_TAURI)
if(PUBLIC_TAURI == true) {
e.preventDefault()
if (fullscreen) { if (fullscreen) {
getCurrentWindow().setFullscreen(false).then(() => { getCurrentWindow().setFullscreen(false).then(() => {
fullscreen = false fullscreen = false
@ -151,6 +154,7 @@ hotkeys.set("F11", {
}); });
} }
} }
}
}) })
hotkeys.set("F12", { hotkeys.set("F12", {