Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: show an alert when the menu bar icon is hidden#153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ethanndickson merged 1 commit intomainfromethan/alert-hidden-icon
May 8, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletionsCoder-Desktop/Coder-Desktop/Coder_DesktopApp.swift
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -126,6 +126,29 @@ class AppDelegate: NSObject, NSApplicationDelegate {
func applicationShouldTerminateAfterLastWindowClosed(_: NSApplication) -> Bool {
false
}

func applicationShouldHandleReopen(_: NSApplication, hasVisibleWindows _: Bool) -> Bool {
if !state.skipHiddenIconAlert, let menuBar, !menuBar.menuBarExtra.isVisible {
displayIconHiddenAlert()
}
return true
}

private func displayIconHiddenAlert() {
let alert = NSAlert()
alert.alertStyle = .informational
alert.messageText = "Coder Desktop is hidden!"
alert.informativeText = """
Coder Desktop is running, but there's no space in the menu bar for it's icon.
You can rearrange icons by holding command.
"""
alert.addButton(withTitle: "OK")
alert.addButton(withTitle: "Don't show again")
let resp = alert.runModal()
if resp == .alertSecondButtonReturn {
state.skipHiddenIconAlert = true
}
}
}

extension AppDelegate {
Expand Down
9 changes: 9 additions & 0 deletionsCoder-Desktop/Coder-Desktop/State.swift
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -69,6 +69,13 @@ class AppState: ObservableObject {
}
}

@Published var skipHiddenIconAlert: Bool = UserDefaults.standard.bool(forKey: Keys.skipHiddenIconAlert) {
didSet {
guard persistent else { return }
UserDefaults.standard.set(skipHiddenIconAlert, forKey: Keys.skipHiddenIconAlert)
}
}

func tunnelProviderProtocol() -> NETunnelProviderProtocol? {
if !hasSession { return nil }
let proto = NETunnelProviderProtocol()
Expand DownExpand Up@@ -209,6 +216,8 @@ class AppState: ObservableObject {
static let literalHeaders = "LiteralHeaders"
static let stopVPNOnQuit = "StopVPNOnQuit"
static let startVPNOnLaunch = "StartVPNOnLaunch"

static let skipHiddenIconAlert = "SkipHiddenIconAlert"
}
}

Expand Down
2 changes: 1 addition & 1 deletionCoder-Desktop/project.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -97,7 +97,7 @@ packages:
# - Set onAppear/disappear handlers.
# The upstream repo has a purposefully limited API
url: https://github.com/coder/fluid-menu-bar-extra
revision:96a861a
revision:8e1d8b8
KeychainAccess:
url: https://github.com/kishikawakatsumi/KeychainAccess
branch: e0c7eebc5a4465a3c4680764f26b7a61f567cdaf
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp