Dev/mihomo control (#339)
* Add Mihomo Control plugin Monitor and control a Mihomo (Clash Meta) external controller from the bar: live traffic graph, proxy mode, proxy-group management with latency tests, and core restart. Works locally (127.0.0.1) or remotely via host/port/secret settings. * Add Chinese (Simplified) translation * Add test-all latency button Adds a Test all button next to the Proxy groups heading that runs latency tests on every group sequentially, with a single summary notification. * Unify traffic and proxy groups section styles Give both sections the same card look: muted medium-weight heading on the left, secondary info on the right, and proxy-group cards restyled as bordered sub-cards inside the section. * Polish proxy group cards Show the selected proxy next to the bold group name (ECS > ecs-proxy), move the expand chevron to the type/members row where the list opens, and drop the list glyph from the card header. * Decouple heights of paired group cards Keep each card in a two-column row at its natural height instead of stretching the neighbor when one is expanded. * Use thumbnail generator to generate thumbnail * mihomo-control: theme-aware panel colors Use theme roles for traffic and latency colors so they stay readable in light mode, and keep the status chip's green/amber/red identity with darker light-mode shades.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
--!nonstrict
|
||||
-- Mihomo Control — control-center shortcut.
|
||||
--
|
||||
-- Quick toggle for the proxy mode: clicking switches between rule and global.
|
||||
-- The tile shows the current mode and lights up while global mode is active.
|
||||
|
||||
local function current_mode()
|
||||
local config = noctalia.state.get("mihomo.config") or {}
|
||||
return config.mode or "rule"
|
||||
end
|
||||
|
||||
local function render()
|
||||
local mode = current_mode()
|
||||
shortcut.setLabel(noctalia.tr("shortcut.label", { mode = noctalia.tr("shortcut.mode_" .. mode) }))
|
||||
shortcut.setIcon("cat")
|
||||
shortcut.setActive(mode == "global")
|
||||
shortcut.setEnabled(true)
|
||||
end
|
||||
|
||||
noctalia.state.watch("mihomo.config", function(_value)
|
||||
render()
|
||||
end)
|
||||
|
||||
function onClick()
|
||||
local next_mode = current_mode() == "global" and "rule" or "global"
|
||||
noctalia.state.set("mihomo.command", {
|
||||
op = "mode",
|
||||
mode = next_mode,
|
||||
seq = math.floor(os.clock() * 1000000),
|
||||
})
|
||||
end
|
||||
|
||||
render()
|
||||
Reference in New Issue
Block a user