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 { PUBLIC_TAURI } from '$env/static/public';
import type { ExpanderType } from "./index.d.ts";
import { getCurrentWindow } from "@tauri-apps/api/window";
import { incTextSize, decTextSize, selectNextColor, toggleMenuOpen, appState } from "$lib/stores.svelte"
@ -136,19 +137,22 @@ hotkeys.set("F2", {
hotkeys.set("F11", {
action: (e) => {
e.preventDefault()
console.log("Toggle fullscreen")
if (fullscreen) {
getCurrentWindow().setFullscreen(false).then(() => {
fullscreen = false
console.log(PUBLIC_TAURI)
if(PUBLIC_TAURI == true) {
e.preventDefault()
if (fullscreen) {
getCurrentWindow().setFullscreen(false).then(() => {
fullscreen = false
});
} else {
getCurrentWindow().setFullscreen(true).then(() => {
fullscreen = true
});
} else {
getCurrentWindow().setFullscreen(true).then(() => {
fullscreen = true
});
});
}
}
}
})