feat: 🚧 Creating the basic menu

This commit is contained in:
Louis Gallet 2023-07-06 18:56:33 +02:00
parent 808afe7ab4
commit aad0425f5f
Signed by: lgallet
SSH Key Fingerprint: SHA256:qnW7pk4EoMRR0UftZLZQKSMUImbEFsiruLC7jbCHJAY
4 changed files with 39 additions and 17 deletions

View File

@ -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 = "<group>"; };
2C162C892A5721BB00C3F8A3 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
2C162C8B2A5721BB00C3F8A3 /* shortmenu.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = shortmenu.entitlements; sourceTree = "<group>"; };
2C162C912A57259B00C3F8A3 /* ApiKeyWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApiKeyWindow.swift; sourceTree = "<group>"; };
2C162C932A5726A900C3F8A3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
/* 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 = (

View File

@ -0,0 +1,11 @@
//
// ApiKeyWindow.swift
// shortmenu
//
// Created by Louis Gallet on 06/07/2023.
//
import Foundation
import SwiftUI
// TODO: Create the popup

8
shortmenu/Info.plist Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSAppleEventsUsageDescription</key>
<string>This app requires access to save your api key locally.</string>
</dict>
</plist>

View File

@ -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)