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
2 changes: 1 addition & 1 deletion Sources/MenubucketCore/UpdateInstaller.swift
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public enum UpdateInstaller {
/// failure that made it necessary was refused by the kernel for the
/// destination path specifically, so the same bundle launched from a
/// staging directory came up perfectly.
public struct Installed {
public struct Installed: Sendable {
public let app: URL
public let version: String?
/// The previous bundle, parked next to `app`. Nil when there was
Expand Down
12 changes: 6 additions & 6 deletions WidgetExtension/BarShelfWidgets.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
36AC0C5864DB27615C69D8BC /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 7B505F8DF3C2A9D1FF94FE91 /* Localizable.xcstrings */; };
4195A0A5241CEF6A27FD0695 /* ShelfWidgetIntent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2961B05761B714139E0AC3AB /* ShelfWidgetIntent.swift */; };
435CBB33D3D3C9EC304AC1D9 /* ShelfTemplates.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0936B164A6CC8C20AA933D7 /* ShelfTemplates.swift */; };
446AF0B171DBCDADC2B8DF85 /* WidgetNodeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C61BB6D5CEA5D1651EF109D8 /* WidgetNodeView.swift */; };
476453C0C400EC58CDCF3F2A /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 7B505F8DF3C2A9D1FF94FE91 /* Localizable.xcstrings */; };
480743A44B71F0316790DCBD /* ShelfWidgetIntent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2961B05761B714139E0AC3AB /* ShelfWidgetIntent.swift */; };
5236C8258B5158648CAFFFFE /* MenubucketCore in Frameworks */ = {isa = PBXBuildFile; productRef = 910104821328EDAEEB51C053 /* MenubucketCore */; };
5A8E9EA08A74F81BCB6A909A /* WidgetNodeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C61BB6D5CEA5D1651EF109D8 /* WidgetNodeView.swift */; };
7984B92A85BDD37317BDAA01 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49D0524C67478B39B0C53A99 /* WidgetKit.framework */; };
7F9C9A39C95831AB300FC7BD /* WidgetPalette.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95789FAD0FF181FBF12F1A5E /* WidgetPalette.swift */; };
B162097A519560CD0658C1AE /* MenubucketCore in Frameworks */ = {isa = PBXBuildFile; productRef = F712C895B770A2690B947749 /* MenubucketCore */; };
BCC5CD171C8CF94762900E0B /* ShelfWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BB49CE264140519F81A6BFF /* ShelfWidget.swift */; };
D053038D4DF70749934C093A /* ShelfWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BB49CE264140519F81A6BFF /* ShelfWidget.swift */; };
E79A3C28FA10A32C6F34A361 /* ShelfTemplates.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0936B164A6CC8C20AA933D7 /* ShelfTemplates.swift */; };
EE48C9CD5D54AD7B4287D537 /* WidgetPalette.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95789FAD0FF181FBF12F1A5E /* WidgetPalette.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -35,11 +35,11 @@
5FE557425549274E252DF4E9 /* barshelf */ = {isa = PBXFileReference; lastKnownFileType = folder; name = barshelf; path = ..; sourceTree = SOURCE_ROOT; };
7B505F8DF3C2A9D1FF94FE91 /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = "<group>"; };
7BB49CE264140519F81A6BFF /* ShelfWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShelfWidget.swift; sourceTree = "<group>"; };
95789FAD0FF181FBF12F1A5E /* WidgetPalette.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WidgetPalette.swift; sourceTree = "<group>"; };
9E670D45E7A7EBE006E48708 /* BarShelfWidgets.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = BarShelfWidgets.appex; sourceTree = BUILT_PRODUCTS_DIR; };
B0936B164A6CC8C20AA933D7 /* ShelfTemplates.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShelfTemplates.swift; sourceTree = "<group>"; };
B7E2C8D8F0992AF74253EA6A /* BarShelfWidgetsBundle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BarShelfWidgetsBundle.swift; sourceTree = "<group>"; };
BAFDAA46AAA4E5811FE4F1DF /* BarShelfWidgetsPreview */ = {isa = PBXFileReference; includeInIndex = 0; path = BarShelfWidgetsPreview; sourceTree = BUILT_PRODUCTS_DIR; };
C61BB6D5CEA5D1651EF109D8 /* WidgetNodeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WidgetNodeView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -119,7 +119,7 @@
B0936B164A6CC8C20AA933D7 /* ShelfTemplates.swift */,
7BB49CE264140519F81A6BFF /* ShelfWidget.swift */,
2961B05761B714139E0AC3AB /* ShelfWidgetIntent.swift */,
C61BB6D5CEA5D1651EF109D8 /* WidgetNodeView.swift */,
95789FAD0FF181FBF12F1A5E /* WidgetPalette.swift */,
);
path = BarShelfWidgets;
sourceTree = "<group>";
Expand Down Expand Up @@ -229,7 +229,7 @@
E79A3C28FA10A32C6F34A361 /* ShelfTemplates.swift in Sources */,
BCC5CD171C8CF94762900E0B /* ShelfWidget.swift in Sources */,
480743A44B71F0316790DCBD /* ShelfWidgetIntent.swift in Sources */,
446AF0B171DBCDADC2B8DF85 /* WidgetNodeView.swift in Sources */,
7F9C9A39C95831AB300FC7BD /* WidgetPalette.swift in Sources */,
137DD31FFDC6820F023437B7 /* main.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -242,7 +242,7 @@
435CBB33D3D3C9EC304AC1D9 /* ShelfTemplates.swift in Sources */,
D053038D4DF70749934C093A /* ShelfWidget.swift in Sources */,
4195A0A5241CEF6A27FD0695 /* ShelfWidgetIntent.swift in Sources */,
5A8E9EA08A74F81BCB6A909A /* WidgetNodeView.swift in Sources */,
EE48C9CD5D54AD7B4287D537 /* WidgetPalette.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
265 changes: 0 additions & 265 deletions WidgetExtension/BarShelfWidgets/WidgetNodeView.swift

This file was deleted.

36 changes: 36 additions & 0 deletions WidgetExtension/BarShelfWidgets/WidgetPalette.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import SwiftUI

/// BarShelf's color names, as widgets draw them. Mirrors `nodeColor` and
/// `WidgetAppearance.accentColor` in the app.
enum WidgetPalette {
static func color(_ name: String?, accent: Color = .accentColor) -> Color? {
guard let raw = name?.trimmingCharacters(in: .whitespaces).lowercased(), !raw.isEmpty else { return nil }
switch raw {
case "primary": return .primary
case "secondary": return .secondary
case "tertiary": return .secondary.opacity(0.6)
case "accent": return accent
case "good", "green": return .green
case "warning", "orange": return .orange
case "danger", "red": return .red
case "neutral", "gray", "grey": return .gray
case "blue": return .blue
case "purple": return .purple
case "pink": return .pink
case "yellow": return .yellow
case "default": return nil
default:
return hex(raw)
}
}

private static func hex(_ value: String) -> Color? {
let digits = value.hasPrefix("#") ? String(value.dropFirst()) : value
guard digits.count == 6, let number = UInt32(digits, radix: 16) else { return nil }
return Color(
red: Double((number >> 16) & 0xFF) / 255,
green: Double((number >> 8) & 0xFF) / 255,
blue: Double(number & 0xFF) / 255
)
}
}
Loading