Skip to content

Commit

Permalink
avoid goldendict getting killed when mpv exits
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsumoto-ren committed Nov 4, 2024
1 parent 8633f0d commit e1a250e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions subtitles/observer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ local function current_subtitle_lines()
return { primary = self.clipboard_prepare(primary), secondary = secondary }
end

local function ensure_goldendict_running()
--- Ensure that goldendict is running and is disowned by mpv.
--- Avoid goldendict getting killed when mpv exits.
if autoclip_enabled and self.autocopy_current_method() == "goldendict" then
os.execute("setsid -f goldendict")
end
end

------------------------------------------------------------
-- autoclip methods

Expand Down Expand Up @@ -270,6 +278,7 @@ end

local function notify_autocopy()
if autoclip_enabled then
ensure_goldendict_running()
copy_primary_sub()
end
h.notify(string.format("Clipboard autocopy has been %s.", self.autocopy_status_str()))
Expand Down

0 comments on commit e1a250e

Please sign in to comment.