mirror of
https://github.com/carey314/mio-plugin-worker.git
synced 2026-08-10 07:04:32 +00:00
Office-survival toolkit. Five tabs in the notch: - 🍅 番茄钟: 25/5 focus/break with circular ring timer + tally. - 🪑 久坐: count-up since last break, dock-bounce alert at 45min. - 💧 喝水: animated cup, daily goal tracking with progress dots. - 🏃 下班: H:M:S countdown to clock-out hour with gradient bar. - 🎉 周末: 天/时/分 to next Saturday + rotating 打工语录. 100% local. UNUserNotificationCenter for alerts, dock-bounce fallback when authorization denied. UserDefaults persistence. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
39 lines
965 B
Swift
39 lines
965 B
Swift
//
|
|
// WorkerPlugin.swift
|
|
// Mio Island plugin: 摸鱼侠
|
|
//
|
|
// Principal class. Module = WorkerPlugin, Class = WorkerPlugin →
|
|
// NSPrincipalClass = "WorkerPlugin.WorkerPlugin".
|
|
//
|
|
|
|
import AppKit
|
|
import SwiftUI
|
|
|
|
final class WorkerPlugin: NSObject, MioPlugin {
|
|
var id: String { "worker" }
|
|
var name: String { "摸鱼侠" }
|
|
var icon: String { "fish.fill" }
|
|
var version: String { "0.1.0" }
|
|
|
|
func activate() {
|
|
WorkerDebugLog.write("plugin activate")
|
|
Task { @MainActor in
|
|
WorkerStore.shared.start()
|
|
WorkerNotificationCenter.shared.requestAuthorizationIfNeeded()
|
|
}
|
|
}
|
|
|
|
func deactivate() {
|
|
WorkerDebugLog.write("plugin deactivate")
|
|
Task { @MainActor in
|
|
WorkerStore.shared.stop()
|
|
}
|
|
}
|
|
|
|
func makeView() -> NSView {
|
|
let view = NSHostingView(rootView: ExpandedView())
|
|
view.autoresizingMask = [.width, .height]
|
|
return view
|
|
}
|
|
}
|