mirror of
https://github.com/swiftbar/SwiftBar.git
synced 2024-09-11 07:55:23 +03:00
Add URL Scheme to set Ephemeral Plugin #357
This commit is contained in:
parent
26e89aabf2
commit
61b0dea1b6
@ -170,6 +170,13 @@ class AppDelegate: NSObject, NSApplicationDelegate, SPUStandardUserDriverDelegat
|
||||
if let src = url.queryParameters?["src"], let url = URL(string: src) {
|
||||
pluginManager.importPlugin(from: url)
|
||||
}
|
||||
case "setephemeralplugin":
|
||||
if let name = url.queryParameters?["name"],
|
||||
case let pluginContent = url.queryParameters?["content"] ?? "",
|
||||
let exitAfter = Double(url.queryParameters?["exitafter"] ?? "0")
|
||||
{
|
||||
pluginManager.setEphemeralPlugin(pluginId: name, content: pluginContent, exitAfter: exitAfter)
|
||||
}
|
||||
case "notify":
|
||||
guard let plugin = getPluginFromURL(url: url) else { return }
|
||||
let paramsString = url.queryParameters?.map { "\($0.key)=\($0.value.escaped())" }.joined(separator: " ") ?? ""
|
||||
|
@ -5,7 +5,10 @@ import os
|
||||
class EphemeralPlugin: Plugin {
|
||||
var id: PluginID
|
||||
let type: PluginType = .Ephemeral
|
||||
let name: String = "Ephemeral"
|
||||
var name: String {
|
||||
"Ephemeral: \(id)"
|
||||
}
|
||||
|
||||
let file: String = "none"
|
||||
var refreshEnv: [String: String] = [:]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user