mpvnet-player / mpv.net

🎞 mpv.net is a media player for Windows with a modern GUI.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hi! Friends, please pop up a confirmation dialog box after triggering the Esc keyboard instead of exiting the player program directly.

zhouxinghong opened this issue · comments

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Hi! Friends, please pop up a confirmation dialog box after triggering the Esc keyboard instead of exiting the player program directly.

When the user triggers the Esc keyboard, a confirmation dialog box should pop up instead of exiting the player program directly. This can avoid user misoperation and prevent accidental termination of the player program.

Thank you very much for providing a very good MPV client🎉

Describe the solution you'd like
A clear and concise description of what you want to happen.

Hi! Friends, please pop up a confirmation dialog box after triggering the Esc keyboard instead of exiting the player program directly.

When the user triggers the Esc keyboard, a confirmation dialog box should pop up instead of exiting the player program directly. This can avoid user misoperation and prevent accidental termination of the player program.

Thank you very much for providing a very good MPV client🎉

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

mpv.net uses default mpv quit command to close the player, so this falls more under a script responsibility:

either:

mp.add_key_binding("ESC", "confirmquit", function()
    if confirm_timer then
        mp.command("quit")
    else
        mp.osd_message("Press ESC again to quit", 1)
        confirm_timer = mp.add_timeout(1, function()
            if confirm_timer then
                confirm_timer:kill()
                confirm_timer = nil
            end
        end)
    end
end)

or:

https://ss64.com/ps/messagebox.html

mp.add_key_binding("ESC", "confirmquit", function()
    local confirm = mp.command_native({name = "subprocess", playback_only = false, args = {"powershell", "-NoProfile", "-Command", [[
        Add-Type -AssemblyName System.Windows.Forms;
        $result = [System.Windows.Forms.MessageBox]::Show('Press OK to quit', 'Confirmation', 'OKCancel', 'Question');
        if ($result -eq 'OK') { exit 0 } else { exit 1 }
    ]]}})
    if confirm and confirm.status == 0 then
        mp.command("quit")
    end
end)

Or even simply adding ESC ignore to input.conf, since i can't think of any player that allows closing it by pressing ESC, seems far too problematic for how easy it is to do it by accident.

If the confirmation dialog box cannot pop up, it is better to disable the Esc to exit the player by default, which will be more user-friendly.

Additionally, most players use Esc to exit full-screen playback rather than terminating the player process.

Also, how do I disable Q exiting the player? This one is just as confusing as Esc.
image

If the confirmation dialog box cannot pop up, it is better to disable the Esc to exit the player by default, which will be more user-friendly.

It can, with one of the scripts. And from what I remember, it was mentioned somewhere that mpv.net philosophy is that if it can be done with a script, then it’s the scripts role, especially when the provided functionality isn’t something implemented exclusively by mpv.net.

Additionally, most players use Esc to exit full-screen playback rather than terminating the player process.

Also, how do I disable Q exiting the player? This one is just as confusing as Esc. image

mpv.net provides very basic set of keybinds out of the box, it's on the user to adjust them to their liking, and there's already a set of links in the manual that have examples of both, including mentions of build-in input editor:

https://github.com/mpvnet-player/mpv.net/blob/main/docs/manual.md#input-and-context-menu
https://mpv.io/manual/master/#input-conf

https://github.com/mpv-player/mpv/blob/74b4c3c531bd454484ed5d04c9aad0bc531ccd4b/etc/input.conf#L85
https://github.com/mpv-player/mpv/blob/74b4c3c531bd454484ed5d04c9aad0bc531ccd4b/etc/input.conf#L12
https://mpv.io/manual/master/#command-interface-ignore

Thank you very much for your help! 🎉