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

Commit565665f

Browse files
feat: show an alert when the menu bar icon is hidden (#153)
Relates to#148.If the menu bar icon is hidden (such as when behind the notch, or otherwise), reopening the app will display an alert that the icon is hidden.There's also a button to not show the alert again.I've also tested that this, and the 'Do not show again' button, work in a fresh VM.This is the same as what Tailscale does:https://github.com/user-attachments/assets/dae6d9ed-eab2-404f-8522-314042bdd1d8
1 parentf039526 commit565665f

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

‎Coder-Desktop/Coder-Desktop/Coder_DesktopApp.swift

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,29 @@ class AppDelegate: NSObject, NSApplicationDelegate {
126126
func applicationShouldTerminateAfterLastWindowClosed(_:NSApplication)->Bool{
127127
false
128128
}
129+
130+
func applicationShouldHandleReopen(_:NSApplication, hasVisibleWindows _:Bool)->Bool{
131+
if !state.skipHiddenIconAlert,let menuBar, !menuBar.menuBarExtra.isVisible{
132+
displayIconHiddenAlert()
133+
}
134+
returntrue
135+
}
136+
137+
privatefunc displayIconHiddenAlert(){
138+
letalert=NSAlert()
139+
alert.alertStyle=.informational
140+
alert.messageText="Coder Desktop is hidden!"
141+
alert.informativeText="""
142+
Coder Desktop is running, but there's no space in the menu bar for it's icon.
143+
You can rearrange icons by holding command.
144+
"""
145+
alert.addButton(withTitle:"OK")
146+
alert.addButton(withTitle:"Don't show again")
147+
letresp= alert.runModal()
148+
if resp==.alertSecondButtonReturn{
149+
state.skipHiddenIconAlert=true
150+
}
151+
}
129152
}
130153

131154
extensionAppDelegate{

‎Coder-Desktop/Coder-Desktop/State.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ class AppState: ObservableObject {
6969
}
7070
}
7171

72+
@PublishedvarskipHiddenIconAlert:Bool=UserDefaults.standard.bool(forKey:Keys.skipHiddenIconAlert){
73+
didSet{
74+
guard persistentelse{return}
75+
UserDefaults.standard.set(skipHiddenIconAlert, forKey:Keys.skipHiddenIconAlert)
76+
}
77+
}
78+
7279
func tunnelProviderProtocol()->NETunnelProviderProtocol?{
7380
if !hasSession{returnnil}
7481
letproto=NETunnelProviderProtocol()
@@ -209,6 +216,8 @@ class AppState: ObservableObject {
209216
staticletliteralHeaders="LiteralHeaders"
210217
staticletstopVPNOnQuit="StopVPNOnQuit"
211218
staticletstartVPNOnLaunch="StartVPNOnLaunch"
219+
220+
staticletskipHiddenIconAlert="SkipHiddenIconAlert"
212221
}
213222
}
214223

‎Coder-Desktop/project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ packages:
9797
# - Set onAppear/disappear handlers.
9898
# The upstream repo has a purposefully limited API
9999
url:https://github.com/coder/fluid-menu-bar-extra
100-
revision:96a861a
100+
revision:8e1d8b8
101101
KeychainAccess:
102102
url:https://github.com/kishikawakatsumi/KeychainAccess
103103
branch:e0c7eebc5a4465a3c4680764f26b7a61f567cdaf

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp