mirror of
https://github.com/markuryy/shark.git
synced 2025-12-12 19:51:01 +00:00
ui: style title bar
This commit is contained in:
@@ -5,6 +5,11 @@
|
|||||||
"windows": ["main"],
|
"windows": ["main"],
|
||||||
"permissions": [
|
"permissions": [
|
||||||
"core:default",
|
"core:default",
|
||||||
"opener:default"
|
"opener:default",
|
||||||
|
"core:window:default",
|
||||||
|
"core:window:allow-start-dragging",
|
||||||
|
"core:window:allow-minimize",
|
||||||
|
"core:window:allow-toggle-maximize",
|
||||||
|
"core:window:allow-close"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,8 @@
|
|||||||
{
|
{
|
||||||
"title": "shark",
|
"title": "shark",
|
||||||
"width": 800,
|
"width": 800,
|
||||||
"height": 600
|
"height": 600,
|
||||||
|
"decorations": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"security": {
|
"security": {
|
||||||
|
|||||||
34
src/lib/TitleBar.svelte
Normal file
34
src/lib/TitleBar.svelte
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||||
|
|
||||||
|
const appWindow = getCurrentWindow();
|
||||||
|
|
||||||
|
async function minimize() {
|
||||||
|
await appWindow.minimize();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function toggleMaximize() {
|
||||||
|
await appWindow.toggleMaximize();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function close() {
|
||||||
|
await appWindow.close();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="title-bar" data-tauri-drag-region>
|
||||||
|
<div class="title-bar-text">shark</div>
|
||||||
|
<div class="title-bar-controls">
|
||||||
|
<button aria-label="Minimize" on:click={minimize}></button>
|
||||||
|
<button aria-label="Maximize" on:click={toggleMaximize}></button>
|
||||||
|
<button aria-label="Close" on:click={close}></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.title-bar {
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 1000;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
6
src/routes/+layout.svelte
Normal file
6
src/routes/+layout.svelte
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import TitleBar from "$lib/TitleBar.svelte";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<TitleBar />
|
||||||
|
<slot />
|
||||||
Reference in New Issue
Block a user