Add close and refresh keybinds
This commit is contained in:
5
app.go
5
app.go
@@ -2,6 +2,8 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
"github.com/wailsapp/wails/v2/pkg/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
// App struct
|
// App struct
|
||||||
@@ -19,3 +21,6 @@ func NewApp() *App {
|
|||||||
func (a *App) startup(ctx context.Context) {
|
func (a *App) startup(ctx context.Context) {
|
||||||
a.ctx = ctx
|
a.ctx = ctx
|
||||||
}
|
}
|
||||||
|
func (a *App) Close() {
|
||||||
|
runtime.Quit(a.ctx)
|
||||||
|
}
|
@@ -2,6 +2,16 @@
|
|||||||
import Header from "$lib/components/Header.svelte";
|
import Header from "$lib/components/Header.svelte";
|
||||||
import Router from "$lib/router/Router.svelte";
|
import Router from "$lib/router/Router.svelte";
|
||||||
import { Toaster } from "svelte-sonner";
|
import { Toaster } from "svelte-sonner";
|
||||||
|
import { Close } from '$wails/main/App'
|
||||||
|
|
||||||
|
function keyDown(event: KeyboardEvent) {
|
||||||
|
if (event.ctrlKey && event.key == "r") {
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
if (event.ctrlKey && event.key == "w") {
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
@@ -55,6 +65,7 @@ toast('Hello World', {
|
|||||||
|
|
||||||
<Toaster hotkey={['KeyC']} />
|
<Toaster hotkey={['KeyC']} />
|
||||||
-->
|
-->
|
||||||
|
<svelte:window on:keydown={keyDown} />
|
||||||
<Toaster theme="dark" expand visibleToasts={9} />
|
<Toaster theme="dark" expand visibleToasts={9} />
|
||||||
<template>
|
<template>
|
||||||
<Header />
|
<Header />
|
||||||
|
4
frontend/wailsjs/go/main/App.d.ts
vendored
Normal file
4
frontend/wailsjs/go/main/App.d.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||||
|
// This file is automatically generated. DO NOT EDIT
|
||||||
|
|
||||||
|
export function Close():Promise<void>;
|
7
frontend/wailsjs/go/main/App.js
Normal file
7
frontend/wailsjs/go/main/App.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
// @ts-check
|
||||||
|
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||||
|
// This file is automatically generated. DO NOT EDIT
|
||||||
|
|
||||||
|
export function Close() {
|
||||||
|
return window['go']['main']['App']['Close']();
|
||||||
|
}
|
Reference in New Issue
Block a user