feat: added more functions to header buttons
- Close Tab - Maximize/minimize/close window
mellbacon committed
Jun 30, 2023 at 09:49 UTC
8473188c48141b8252a28e677f58bc6044bf392e
1 file changed
+5
-5
src/lib/Header.svelte
+5
-5
@@ -2,7 +2,7 @@
2
import { appWindow } from "@tauri-apps/api/window";
3
import Dropdown from "./utility/Dropdown.svelte";
4
import Settings from "carbon-icons-svelte/lib/Settings.svelte";
5
- import { addTab, addEditorTab } from "../lib/EditorTabList.svelte";
5
+ import { addTab, addEditorTab, tabs, closeActiveTab } from "../lib/EditorTabList.svelte";
6
import { saveFile, openFile, openFolder, workspaceName } from "./File";
7
8
const items = [
@@ -12,7 +12,7 @@
12
{name: "Open Folder...", shortcut: "Ctrl + K", action: async () => {await openFolder()}},
13
{name: "Save File", shortcut: "Ctrl + S", action: async () => {await saveFile()}},
14
{name: "Save File As...", shortcut: "Ctrl + Shift + S", action: async () => {await saveFile(true)}},
15
- {name: "Close Tab", disabled: true, shortcut: "", action: () => {console.warn("Feature not implemented yet.")}},
15
+ {name: "Close Tab", disabled: $tabs.length === 0, shortcut: "", action: async () => {await closeActiveTab()}},
16
]},
17
{menuname: "Edit", children: [
18
{name: "Undo", shortcut: "Ctrl + Z", action: () => {console.warn("Feature not implemented yet.")}},
@@ -40,9 +40,9 @@
40
]},
41
{menuname: "Window", children: [
42
{name: "New Window", disabled: true, shortcut: "Ctrl + Shift + N", action: () => {console.warn("Feature not implemented yet.")}},
43
- {name: "Minimize Window", shortcut: "", action: () => {console.warn("Feature not implemented yet.")}},
44
- {name: "Maximize Window", shortcut: "", action: () => {console.warn("Feature not implemented yet.")}},
45
- {name: "Close Window", shortcut: "Alt + F4", action: () => {console.warn("Feature not implemented yet.")}},
43
+ {name: "Minimize Window", shortcut: "", action: async () => {await appWindow.minimize()}},
44
+ {name: "Maximize Window", shortcut: "", action: async () => {await appWindow.maximize()}},
45
+ {name: "Close Window", shortcut: "Alt + F4", action: async () => {await appWindow.close()}},
46
]},
47
{menuname: "Help", children: [
48
{name: "Send Feedback", disabled: true, shortcut: "", action: () => {console.warn("Feature not implemented yet.")}},