From 0cd4e1b78d96b663d992bf4376483d90d19935f2 Mon Sep 17 00:00:00 2001 From: david-swift Date: Wed, 5 Nov 2025 21:58:28 +0100 Subject: [PATCH] Update to GNOME 49 --- Sources/AdwaitaTemplate.swift | 2 + Sources/Localized.yml | 40 +++++++++----- Sources/ToolbarView.swift | 63 +++++++++++++--------- io.github.AparokshaUI.AdwaitaTemplate.json | 2 +- 4 files changed, 67 insertions(+), 40 deletions(-) diff --git a/Sources/AdwaitaTemplate.swift b/Sources/AdwaitaTemplate.swift index cfcb031..5e85a80 100644 --- a/Sources/AdwaitaTemplate.swift +++ b/Sources/AdwaitaTemplate.swift @@ -17,6 +17,8 @@ struct AdwaitaTemplate: App { } } .defaultSize(width: 450, height: 300) + .quitShortcut() + .closeShortcut() } } diff --git a/Sources/Localized.yml b/Sources/Localized.yml index f00309d..59b0613 100644 --- a/Sources/Localized.yml +++ b/Sources/Localized.yml @@ -1,21 +1,33 @@ default: en -helloWorld: - en: Hello, world! - de: Hallo, Welt! - -newWindow: - en: New Window - de: Neues Fenster +about: + de: "Info zu AdwaitaTemplate" + en: "About AdwaitaTemplate" closeWindow: - en: Close Window - de: Fenster schliessen + de: "Fenster schliessen" + en: "Close Window" -about: - en: About AdwaitaTemplate - de: Info zu AdwaitaTemplate +generalShortcuts: + de: "Allgemein" + en: "General" + +helloWorld: + de: "Hallo, Welt!" + en: "Hello, world!" + +keyboardShortcuts: + de: "Tastenkürzel" + en: "Keyboard Shortcuts" mainMenu: - en: Main Menu - de: Hauptmenü \ No newline at end of file + de: "Hauptmenü" + en: "Main Menu" + +newWindow: + de: "Neues Fenster" + en: "New Window" + +quitShortcut: + de: "App beenden" + en: "Quit the Application" diff --git a/Sources/ToolbarView.swift b/Sources/ToolbarView.swift index 1d234a2..cb68337 100644 --- a/Sources/ToolbarView.swift +++ b/Sources/ToolbarView.swift @@ -3,38 +3,51 @@ import Adwaita struct ToolbarView: View { @State private var about = false + @State private var shortcuts = false var app: AdwaitaApp var window: AdwaitaWindow var view: Body { HeaderBar.end { - Menu(icon: .default(icon: .openMenu)) { - MenuButton(Loc.newWindow, window: false) { - app.addWindow("main") + content + .aboutDialog( + visible: $about, + app: "AdwaitaTemplate", + developer: "david-swift", + version: "dev", + icon: .custom(name: "io.github.AparokshaUI.AdwaitaTemplate"), + website: .init(string: "https://git.aparoksha.dev/aparoksha/adwaita-template")!, + issues: .init(string: "https://git.aparoksha.dev/aparoksha/adwaita-template/issues")! + ) + .shortcutsDialog(visible: $shortcuts) + .shortcutsSection { section in + section + .shortcutsItem(Loc.newWindow, accelerator: "n".ctrl()) + .shortcutsItem(Loc.closeWindow, accelerator: "w".ctrl()) + .shortcutsItem(Loc.quitShortcut, accelerator: "q".ctrl()) + .shortcutsItem(Loc.keyboardShortcuts, accelerator: "question".ctrl()) } - .keyboardShortcut("n".ctrl()) - MenuButton(Loc.closeWindow) { - window.close() - } - .keyboardShortcut("w".ctrl()) - MenuSection { - MenuButton(Loc.about, window: false) { - about = true - } - } - } - .primary() - .tooltip(Loc.mainMenu) - .aboutDialog( - visible: $about, - app: "AdwaitaTemplate", - developer: "david-swift", - version: "dev", - icon: .custom(name: "io.github.AparokshaUI.AdwaitaTemplate"), - website: .init(string: "https://git.aparoksha.dev/aparoksha/adwaita-template")!, - issues: .init(string: "https://git.aparoksha.dev/aparoksha/adwaita-template/issues")! - ) } } + var content: AnyView { + Menu(icon: .default(icon: .openMenu)) { + MenuButton(Loc.newWindow, window: false) { + app.addWindow("main") + } + .keyboardShortcut("n".ctrl()) + MenuSection { + MenuButton(Loc.keyboardShortcuts, window: false) { + shortcuts = true + } + .keyboardShortcut("question".ctrl()) + MenuButton(Loc.about, window: false) { + about = true + } + } + } + .primary() + .tooltip(Loc.mainMenu) + } + } diff --git a/io.github.AparokshaUI.AdwaitaTemplate.json b/io.github.AparokshaUI.AdwaitaTemplate.json index ac7f8cc..1b7f4da 100644 --- a/io.github.AparokshaUI.AdwaitaTemplate.json +++ b/io.github.AparokshaUI.AdwaitaTemplate.json @@ -1,7 +1,7 @@ { "app-id": "io.github.AparokshaUI.AdwaitaTemplate", "runtime": "org.gnome.Platform", - "runtime-version": "48", + "runtime-version": "49", "sdk": "org.gnome.Sdk", "sdk-extensions": [ "org.freedesktop.Sdk.Extension.swift6"