Skip to content

Instantly share code, notes, and snippets.

@bunkbail
Created December 9, 2025 11:09
Show Gist options
  • Select an option

  • Save bunkbail/84f7fc4f8b027d253d94d3792165a589 to your computer and use it in GitHub Desktop.

Select an option

Save bunkbail/84f7fc4f8b027d253d94d3792165a589 to your computer and use it in GitHub Desktop.
Fix mpv hanging on exit with lsfg-vk on linux
local utils = require 'mp.utils'
mp.register_event("shutdown", function()
mp.msg.warn("Shutdown detected. Saving state and force killing...")
-- 1. Manually force mpv to save the "watch later" position immediately.
mp.command("write-watch-later-config")
-- 2. Get the PID
local pid = mp.get_property("pid")
-- 3. Execute the kill command
os.execute("kill -9 " .. pid)
end)
@bunkbail
Copy link
Author

bunkbail commented Dec 9, 2025

Put the lua script inside your mpv/scripts folder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment