mirror of
https://github.com/carey314/mio-plugin-clipper.git
synced 2026-08-10 07:44:32 +00:00
38 lines
915 B
Swift
38 lines
915 B
Swift
|
|
//
|
||
|
|
// ClipperPlugin.swift
|
||
|
|
// Mio Island plugin: 划词侠
|
||
|
|
//
|
||
|
|
// Principal class. Module = ClipperPlugin, Class = ClipperPlugin →
|
||
|
|
// NSPrincipalClass = "ClipperPlugin.ClipperPlugin".
|
||
|
|
//
|
||
|
|
|
||
|
|
import AppKit
|
||
|
|
import SwiftUI
|
||
|
|
|
||
|
|
final class ClipperPlugin: NSObject, MioPlugin {
|
||
|
|
var id: String { "clipper" }
|
||
|
|
var name: String { "划词侠" }
|
||
|
|
var icon: String { "wand.and.stars" }
|
||
|
|
var version: String { "0.1.0" }
|
||
|
|
|
||
|
|
func activate() {
|
||
|
|
ClipperDebugLog.write("plugin activate")
|
||
|
|
Task { @MainActor in
|
||
|
|
ClipperStore.shared.activate()
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func deactivate() {
|
||
|
|
ClipperDebugLog.write("plugin deactivate")
|
||
|
|
Task { @MainActor in
|
||
|
|
ClipperStore.shared.deactivate()
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func makeView() -> NSView {
|
||
|
|
let view = NSHostingView(rootView: ExpandedView())
|
||
|
|
view.autoresizingMask = [.width, .height]
|
||
|
|
return view
|
||
|
|
}
|
||
|
|
}
|