Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 8 additions & 0 deletions ActionBar.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
A10001000000000000000017 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A10002000000000000000017 /* SettingsView.swift */; };
A10001000000000000000018 /* Sparkle in Frameworks */ = {isa = PBXBuildFile; productRef = A1000C000000000000000001 /* Sparkle */; };
A10001000000000000000019 /* UpdaterService.swift in Sources */ = {isa = PBXBuildFile; fileRef = A10002000000000000000019 /* UpdaterService.swift */; };
A10001000000000000000021 /* GitHubModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = A10002000000000000000021 /* GitHubModels.swift */; };
A10001000000000000000022 /* Components.swift in Sources */ = {isa = PBXBuildFile; fileRef = A10002000000000000000022 /* Components.swift */; };
/* End PBXBuildFile section */


Expand All @@ -52,6 +54,8 @@
A10003000000000000000001 /* ActionBar.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ActionBar.app; sourceTree = BUILT_PRODUCTS_DIR; };
A10002000000000000000018 /* Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Base.xcconfig; path = Config/Base.xcconfig; sourceTree = "<group>"; };
A10002000000000000000019 /* UpdaterService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdaterService.swift; sourceTree = "<group>"; };
A10002000000000000000021 /* GitHubModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GitHubModels.swift; sourceTree = "<group>"; };
A10002000000000000000022 /* Components.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Components.swift; sourceTree = "<group>"; };
A10002000000000000000020 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -112,6 +116,7 @@
children = (
A10002000000000000000003 /* WorkflowRun.swift */,
A10002000000000000000004 /* AppState.swift */,
A10002000000000000000021 /* GitHubModels.swift */,
);
path = Models;
sourceTree = "<group>";
Expand All @@ -137,6 +142,7 @@
A10002000000000000000012 /* AboutView.swift */,
A10002000000000000000013 /* MenuContentView.swift */,
A10002000000000000000017 /* SettingsView.swift */,
A10002000000000000000022 /* Components.swift */,
);
path = Views;
sourceTree = "<group>";
Expand Down Expand Up @@ -248,6 +254,8 @@
A10001000000000000000014 /* RelativeTime.swift in Sources */,
A10001000000000000000015 /* MenuBarIcon.swift in Sources */,
A10001000000000000000017 /* SettingsView.swift in Sources */,
A10001000000000000000021 /* GitHubModels.swift in Sources */,
A10001000000000000000022 /* Components.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Requirements: macOS 14+ and a recent version of Xcode.
2. Copy `Config/Local.xcconfig.example` to `Config/Local.xcconfig` and set your Apple Developer Team ID and a bundle identifier registered to your team.
3. Open `ActionBar.xcodeproj` and run the `ActionBar` scheme, or use `make run`.

The app authenticates through the official ActionBar GitHub App. If you're shipping your own fork, register your own [GitHub App](https://docs.github.com/en/apps/creating-github-apps) with device flow enabled and **Actions (read)** permission, then update `clientID` in `Sources/ActionBar/Services/OAuthService.swift` and the app's installation URL. You'll also need your own Sparkle key pair and feed URL in `Resources/Info.plist` (see below).
The app authenticates through the official ActionBar GitHub App. If you're shipping your own fork, register your own [GitHub App](https://docs.github.com/en/apps/creating-github-apps) with device flow enabled and **Actions (read)** permission, then update `GitHubApp.clientID` and `GitHubApp.installationURL` in `Sources/ActionBar/Services/OAuthService.swift`. You'll also need your own Sparkle key pair and feed URL in `Resources/Info.plist` (see below).

## Releasing

Expand Down
14 changes: 6 additions & 8 deletions Sources/ActionBar/App/ActionBarApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import SwiftUI

@main
struct ActionBarApp: App {
@NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
@NSApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate
@StateObject private var appState = AppState()
@StateObject private var updater = UpdaterService()

Expand All @@ -19,17 +19,15 @@ struct ActionBarApp: App {
}
}

struct MenuBarLabel: View {
private struct MenuBarLabel: View {
@ObservedObject var appState: AppState

var body: some View {
Image(nsImage: makeIcon())
Image(nsImage: MenuBarIcon.image(statusDotColor: statusDotColor))
}

private func makeIcon() -> NSImage {
let dotColor: NSColor? = appState.isAuthenticated && !appState.runs.isEmpty
? MenuBarIcon.statusColor(for: appState.overallStatus)
: nil
return MenuBarIcon.makeMenuBarIcon(statusDotColor: dotColor)
private var statusDotColor: NSColor? {
guard appState.isAuthenticated && !appState.runs.isEmpty else { return nil }
return appState.overallStatus.color
}
}
16 changes: 6 additions & 10 deletions Sources/ActionBar/App/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import AppKit
import UserNotifications

final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDelegate {
private var windowObserver: Any?
private var configuredPanels = NSHashTable<NSPanel>.weakObjects()
private var windowObserver: NSObjectProtocol?

func applicationDidFinishLaunching(_ notification: Notification) {
UNUserNotificationCenter.current().delegate = self
Expand All @@ -14,14 +13,11 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent
forName: NSWindow.didBecomeKeyNotification,
object: nil,
queue: .main
) { [weak self] notification in
guard let panel = notification.object as? NSPanel else { return }
guard !panel.isKind(of: NSOpenPanel.self) else { return }
guard let self, !self.configuredPanels.contains(panel) else { return }
panel.collectionBehavior.insert(
[.canJoinAllSpaces, .stationary, .fullScreenAuxiliary]
)
self.configuredPanels.add(panel)
) { notification in
let behavior: NSWindow.CollectionBehavior = [.canJoinAllSpaces, .stationary, .fullScreenAuxiliary]
guard let panel = notification.object as? NSPanel, !(panel is NSOpenPanel),
!panel.collectionBehavior.contains(behavior) else { return }
panel.collectionBehavior.insert(behavior)
}
}

Expand Down
Loading
Loading