From aad0425f5fc999b700d332641b2f2b7c61c204ce Mon Sep 17 00:00:00 2001 From: Louis Date: Thu, 6 Jul 2023 18:56:33 +0200 Subject: [PATCH] feat: :construction: Creating the basic menu --- shortmenu.xcodeproj/project.pbxproj | 8 ++++++++ shortmenu/ApiKeyWindow.swift | 11 +++++++++++ shortmenu/Info.plist | 8 ++++++++ shortmenu/shortmenuApp.swift | 29 ++++++++++++----------------- 4 files changed, 39 insertions(+), 17 deletions(-) create mode 100644 shortmenu/ApiKeyWindow.swift create mode 100644 shortmenu/Info.plist diff --git a/shortmenu.xcodeproj/project.pbxproj b/shortmenu.xcodeproj/project.pbxproj index 18486b9..a9b2cee 100644 --- a/shortmenu.xcodeproj/project.pbxproj +++ b/shortmenu.xcodeproj/project.pbxproj @@ -11,6 +11,7 @@ 2C162C852A5721BA00C3F8A3 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C162C842A5721BA00C3F8A3 /* ContentView.swift */; }; 2C162C872A5721BB00C3F8A3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2C162C862A5721BB00C3F8A3 /* Assets.xcassets */; }; 2C162C8A2A5721BB00C3F8A3 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2C162C892A5721BB00C3F8A3 /* Preview Assets.xcassets */; }; + 2C162C922A57259B00C3F8A3 /* ApiKeyWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C162C912A57259B00C3F8A3 /* ApiKeyWindow.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -20,6 +21,8 @@ 2C162C862A5721BB00C3F8A3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 2C162C892A5721BB00C3F8A3 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 2C162C8B2A5721BB00C3F8A3 /* shortmenu.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = shortmenu.entitlements; sourceTree = ""; }; + 2C162C912A57259B00C3F8A3 /* ApiKeyWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApiKeyWindow.swift; sourceTree = ""; }; + 2C162C932A5726A900C3F8A3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -52,7 +55,9 @@ 2C162C812A5721BA00C3F8A3 /* shortmenu */ = { isa = PBXGroup; children = ( + 2C162C932A5726A900C3F8A3 /* Info.plist */, 2C162C822A5721BA00C3F8A3 /* shortmenuApp.swift */, + 2C162C912A57259B00C3F8A3 /* ApiKeyWindow.swift */, 2C162C842A5721BA00C3F8A3 /* ContentView.swift */, 2C162C862A5721BB00C3F8A3 /* Assets.xcassets */, 2C162C8B2A5721BB00C3F8A3 /* shortmenu.entitlements */, @@ -140,6 +145,7 @@ buildActionMask = 2147483647; files = ( 2C162C852A5721BA00C3F8A3 /* ContentView.swift in Sources */, + 2C162C922A57259B00C3F8A3 /* ApiKeyWindow.swift in Sources */, 2C162C832A5721BA00C3F8A3 /* shortmenuApp.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -274,6 +280,7 @@ ENABLE_HARDENED_RUNTIME = YES; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = shortmenu/Info.plist; INFOPLIST_KEY_LSUIElement = YES; INFOPLIST_KEY_NSHumanReadableCopyright = ""; LD_RUNPATH_SEARCH_PATHS = ( @@ -302,6 +309,7 @@ ENABLE_HARDENED_RUNTIME = YES; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = shortmenu/Info.plist; INFOPLIST_KEY_LSUIElement = YES; INFOPLIST_KEY_NSHumanReadableCopyright = ""; LD_RUNPATH_SEARCH_PATHS = ( diff --git a/shortmenu/ApiKeyWindow.swift b/shortmenu/ApiKeyWindow.swift new file mode 100644 index 0000000..e9a8e45 --- /dev/null +++ b/shortmenu/ApiKeyWindow.swift @@ -0,0 +1,11 @@ +// +// ApiKeyWindow.swift +// shortmenu +// +// Created by Louis Gallet on 06/07/2023. +// + +import Foundation +import SwiftUI + +// TODO: Create the popup diff --git a/shortmenu/Info.plist b/shortmenu/Info.plist new file mode 100644 index 0000000..fd7a288 --- /dev/null +++ b/shortmenu/Info.plist @@ -0,0 +1,8 @@ + + + + + NSAppleEventsUsageDescription + This app requires access to save your api key locally. + + diff --git a/shortmenu/shortmenuApp.swift b/shortmenu/shortmenuApp.swift index 74652c3..a5a0151 100644 --- a/shortmenu/shortmenuApp.swift +++ b/shortmenu/shortmenuApp.swift @@ -9,24 +9,19 @@ import SwiftUI @main struct shortmenuApp: App { - @State var currentNumber: String = "1" - var body: some Scene { - MenuBarExtra(currentNumber, systemImage: "link.circle.fill") { - //3 - Button("One") { - currentNumber = "1" - } - .keyboardShortcut("1") - Button("Two") { - currentNumber = "2" - } - .keyboardShortcut("2") - Button("Three") { - currentNumber = "3" - } - .keyboardShortcut("3") - Divider() + @State private var apiKey = "" + @State private var isAPIKeyWindowVisible = false + var body: some Scene { + MenuBarExtra("ShortApp", systemImage: "link.circle.fill") { + Button("ShortURL") { + print("clicked!") + } + .keyboardShortcut("S") + Button("Define API Key") { + isAPIKeyWindowVisible = true + } + Divider() Button("Quit") { NSApplication.shared.terminate(nil)