Giter Site home page Giter Site logo

Hi! Friends, please pop up a confirmation dialog box after triggering the Esc keyboard instead of exiting the player program directly. about mpv.net HOT 6 CLOSED

zhouxinghong avatar zhouxinghong commented on June 9, 2024
Hi! Friends, please pop up a confirmation dialog box after triggering the Esc keyboard instead of exiting the player program directly.

from mpv.net.

Comments (6)

Sneakpeakcss avatar Sneakpeakcss commented on June 9, 2024 1

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.

from mpv.net.

zhouxinghong avatar zhouxinghong commented on June 9, 2024 1

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

from mpv.net.

zhouxinghong avatar zhouxinghong commented on June 9, 2024 1

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

from mpv.net.

Sneakpeakcss avatar Sneakpeakcss commented on June 9, 2024 1

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

from mpv.net.

zhouxinghong avatar zhouxinghong commented on June 9, 2024

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.

from mpv.net.

zhouxinghong avatar zhouxinghong commented on June 9, 2024

Thank you very much for your help! πŸŽ‰

from mpv.net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.