Skip to content

Commit

Permalink
Improved Plugins screen usability #301
Browse files Browse the repository at this point in the history
  • Loading branch information
melonamin committed Oct 23, 2022
1 parent 2ff1a5a commit 514cd73
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
4 changes: 4 additions & 0 deletions SwiftBar/Plugin/PluginMetadata.swift
Expand Up @@ -179,6 +179,10 @@ class PluginMetadata: ObservableObject {
}
}

static func cleanMetadata(fileURL: URL) {
try? fileURL.removeExtendedAttribute(forName: "com.ameba.SwiftBar")
}

static func empty() -> PluginMetadata {
PluginMetadata()
}
Expand Down
21 changes: 18 additions & 3 deletions SwiftBar/UI/Preferences/PluginDetailsView.swift
Expand Up @@ -95,9 +95,24 @@ struct PluginDetailsView: View {

Preferences.Section(title: "", content: {})
Preferences.Section(label: {
Button("Save in Plugin File", action: {
PluginMetadata.writeMetadata(metadata: md, fileURL: URL(fileURLWithPath: plugin.file))
})
HStack {
if #available(macOS 11.0, *) {
Button(action: {
NSWorkspace.shared.open(URL(string: "https://github.com/swiftbar/SwiftBar#metadata-for-binary-plugins")!)
}, label: {
Image(systemName: "questionmark.circle")
})
}
Spacer()
Button("Reset", action: {
PluginMetadata.cleanMetadata(fileURL: URL(fileURLWithPath: plugin.file))
plugin.refreshPluginMetadata()
})
Button("Save in Plugin File", action: {
PluginMetadata.writeMetadata(metadata: md, fileURL: URL(fileURLWithPath: plugin.file))
})
}

}, content: {})
}
}
Expand Down

0 comments on commit 514cd73

Please sign in to comment.