mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-06-10 03:13:32 -07:00
144373db52
- Add Catppuccin Macchiato overlay notification stack with 3s transient timeout - Add `notifications.overlayPosition` config (top-left | top | top-right) - Route startup tokenization and subtitle annotation status through configured surfaces - Deduplicate rapid subtitle mode toggle notifications - Change `both` to mean overlay + system; add `osd-system` as legacy alias for old behavior - Keep `osd`/`osd-system` as config-file-only legacy values; Settings UI offers overlay/system/both/none
68 lines
2.0 KiB
Lua
68 lines
2.0 KiB
Lua
local M = {}
|
|
|
|
function M.create(ctx)
|
|
local mp = ctx.mp
|
|
local opts = ctx.opts
|
|
local process = ctx.process
|
|
local hover = ctx.hover
|
|
local ui = ctx.ui
|
|
local state = ctx.state
|
|
|
|
local function register_script_messages()
|
|
mp.register_script_message("subminer-start", function(...)
|
|
process.start_overlay_from_script_message(...)
|
|
end)
|
|
mp.register_script_message("subminer-stop", function()
|
|
process.stop_overlay()
|
|
end)
|
|
mp.register_script_message("subminer-toggle", function()
|
|
process.toggle_overlay()
|
|
end)
|
|
mp.register_script_message("subminer-visible-overlay-hidden", function()
|
|
process.record_visible_overlay_visibility(false)
|
|
end)
|
|
mp.register_script_message("subminer-visible-overlay-shown", function()
|
|
process.record_visible_overlay_visibility(true)
|
|
end)
|
|
mp.register_script_message("subminer-managed-subtitles-loading", function()
|
|
state.skip_managed_subtitle_rearm_once = true
|
|
state.app_managed_playback_pending = true
|
|
end)
|
|
mp.register_script_message("subminer-menu", function()
|
|
ui.show_menu()
|
|
end)
|
|
mp.register_script_message("subminer-options", function()
|
|
process.open_options()
|
|
end)
|
|
mp.register_script_message("subminer-restart", function()
|
|
process.restart_overlay()
|
|
end)
|
|
mp.register_script_message("subminer-status", function()
|
|
process.check_status()
|
|
end)
|
|
mp.register_script_message("subminer-autoplay-ready", function()
|
|
process.notify_auto_play_ready()
|
|
end)
|
|
mp.register_script_message(hover.HOVER_MESSAGE_NAME, function(payload_json)
|
|
hover.handle_hover_message(payload_json)
|
|
end)
|
|
mp.register_script_message(hover.HOVER_MESSAGE_NAME_LEGACY, function(payload_json)
|
|
hover.handle_hover_message(payload_json)
|
|
end)
|
|
mp.register_script_message("subminer-stats-toggle", function()
|
|
if opts.osd_messages then
|
|
mp.osd_message("Stats: press ` (backtick) in overlay", 3)
|
|
end
|
|
end)
|
|
mp.register_script_message("subminer-reload-session-bindings", function()
|
|
ctx.session_bindings.reload_bindings()
|
|
end)
|
|
end
|
|
|
|
return {
|
|
register_script_messages = register_script_messages,
|
|
}
|
|
end
|
|
|
|
return M
|