|
@@ -254,7 +254,7 @@ final class InAppBrowserWindowController: NSWindowController, NSWindowDelegate {
|
|
|
addToStatusBarButton = makeIconButton(
|
|
addToStatusBarButton = makeIconButton(
|
|
|
symbolName: "arrow.up.square",
|
|
symbolName: "arrow.up.square",
|
|
|
accessibility: "Add to Status Bar",
|
|
accessibility: "Add to Status Bar",
|
|
|
- action: #selector(addCurrentPageToStatusBar),
|
|
|
|
|
|
|
+ action: #selector(toggleCurrentPageStatusBar),
|
|
|
fallbackSymbolName: "square.and.arrow.up"
|
|
fallbackSymbolName: "square.and.arrow.up"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
@@ -519,7 +519,7 @@ final class InAppBrowserWindowController: NSWindowController, NSWindowDelegate {
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @objc private func addCurrentPageToStatusBar() {
|
|
|
|
|
|
|
+ @objc private func toggleCurrentPageStatusBar() {
|
|
|
guard PremiumStore.shared.isPremiumUnlocked else {
|
|
guard PremiumStore.shared.isPremiumUnlocked else {
|
|
|
showAlert(
|
|
showAlert(
|
|
|
title: "Premium required",
|
|
title: "Premium required",
|
|
@@ -535,15 +535,22 @@ final class InAppBrowserWindowController: NSWindowController, NSWindowDelegate {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
var ids = LauncherApp.statusBarShortcutIDSet()
|
|
var ids = LauncherApp.statusBarShortcutIDSet()
|
|
|
- guard ids.insert(app.id).inserted else {
|
|
|
|
|
- showAlert(title: "Already added", message: "“\(app.name)” is already in the menu bar.")
|
|
|
|
|
- return
|
|
|
|
|
|
|
+ if ids.contains(app.id) {
|
|
|
|
|
+ ids.remove(app.id)
|
|
|
|
|
+ LauncherApp.persistStatusBarShortcutIDs(ids)
|
|
|
|
|
+ showAlert(
|
|
|
|
|
+ title: "Removed from Status Bar",
|
|
|
|
|
+ message: "“\(app.name)” was removed from the menu bar."
|
|
|
|
|
+ )
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ids.insert(app.id)
|
|
|
|
|
+ LauncherApp.persistStatusBarShortcutIDs(ids)
|
|
|
|
|
+ showAlert(
|
|
|
|
|
+ title: "Added to Status Bar",
|
|
|
|
|
+ message: "“\(app.name)” now has its own icon in the menu bar. Click it to open, or right‑click to remove."
|
|
|
|
|
+ )
|
|
|
}
|
|
}
|
|
|
- LauncherApp.persistStatusBarShortcutIDs(ids)
|
|
|
|
|
- showAlert(
|
|
|
|
|
- title: "Added to Status Bar",
|
|
|
|
|
- message: "“\(app.name)” now has its own icon in the menu bar. Click it to open, or right‑click to remove."
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ updateAddToStatusBarButtonAppearance()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@objc private func addCurrentPageToDesktop() {
|
|
@objc private func addCurrentPageToDesktop() {
|
|
@@ -598,13 +605,37 @@ final class InAppBrowserWindowController: NSWindowController, NSWindowDelegate {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private func updateAddToStatusBarButtonAppearance() {
|
|
private func updateAddToStatusBarButtonAppearance() {
|
|
|
- if resolvedLauncherAppForCurrentPage() == nil {
|
|
|
|
|
|
|
+ let cfg = NSImage.SymbolConfiguration(pointSize: 12, weight: .semibold)
|
|
|
|
|
+ guard let app = resolvedLauncherAppForCurrentPage() else {
|
|
|
addToStatusBarButton.isEnabled = false
|
|
addToStatusBarButton.isEnabled = false
|
|
|
addToStatusBarButton.toolTip = "Add to Status Bar — open this site from the launcher first"
|
|
addToStatusBarButton.toolTip = "Add to Status Bar — open this site from the launcher first"
|
|
|
|
|
+ let img = NSImage(systemSymbolName: "arrow.up.square", accessibilityDescription: "Add to Status Bar")?
|
|
|
|
|
+ .withSymbolConfiguration(cfg)
|
|
|
|
|
+ addToStatusBarButton.image = img
|
|
|
|
|
+ addToStatusBarButton.image?.isTemplate = true
|
|
|
|
|
+ setToggledStyle(addToStatusBarButton, isOn: false)
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ addToStatusBarButton.isEnabled = true
|
|
|
|
|
+ let inBar = LauncherApp.statusBarShortcutIDSet().contains(app.id)
|
|
|
|
|
+ if inBar {
|
|
|
|
|
+ let img = NSImage(systemSymbolName: "arrow.down.square", accessibilityDescription: "Remove from Status Bar")?
|
|
|
|
|
+ .withSymbolConfiguration(cfg)
|
|
|
|
|
+ ?? NSImage(systemSymbolName: "minus.square", accessibilityDescription: "Remove from Status Bar")?
|
|
|
|
|
+ .withSymbolConfiguration(cfg)
|
|
|
|
|
+ addToStatusBarButton.image = img
|
|
|
|
|
+ addToStatusBarButton.image?.isTemplate = true
|
|
|
|
|
+ addToStatusBarButton.toolTip = "Remove from Status Bar"
|
|
|
|
|
+ setToggledStyle(addToStatusBarButton, isOn: true)
|
|
|
} else {
|
|
} else {
|
|
|
- addToStatusBarButton.isEnabled = true
|
|
|
|
|
|
|
+ let img = NSImage(systemSymbolName: "arrow.up.square", accessibilityDescription: "Add to Status Bar")?
|
|
|
|
|
+ .withSymbolConfiguration(cfg)
|
|
|
|
|
+ addToStatusBarButton.image = img
|
|
|
|
|
+ addToStatusBarButton.image?.isTemplate = true
|
|
|
addToStatusBarButton.toolTip = "Add to Status Bar"
|
|
addToStatusBarButton.toolTip = "Add to Status Bar"
|
|
|
|
|
+ setToggledStyle(addToStatusBarButton, isOn: false)
|
|
|
}
|
|
}
|
|
|
|
|
+ addToStatusBarButton.refreshVisuals()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@objc private func togglePinOnTop() {
|
|
@objc private func togglePinOnTop() {
|