osc.lua: cycle window-maximized when right clicking fullscreen

And add script-opts to configure the fullscreen button bindings.
This commit is contained in:
Guido Cella 2024-10-22 23:05:38 +02:00 committed by Kacper Michajłow
parent dab5cf4ab0
commit 165159fdef
2 changed files with 15 additions and 2 deletions

View File

@ -121,6 +121,7 @@ vol
fs fs
============= ================================================ ============= ================================================
left-click toggle fullscreen left-click toggle fullscreen
right-click toggle whether the window is maximized
============= ================================================ ============= ================================================
Key Bindings Key Bindings
@ -562,6 +563,12 @@ clicked. ``mbtn_mid`` commands are also triggered with ``shift+mbtn_left``.
``volume_wheel_up_command=add volume 5`` ``volume_wheel_up_command=add volume 5``
``fullscreen_mbtn_left_command="cycle fullscreen"``
``fullscreen_mbtn_mid_command=``
``fullscreen_mbtn_right_command="cycle window-maximized"``
Script Commands Script Commands
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~

View File

@ -111,6 +111,10 @@ local user_opts = {
volume_mbtn_right_command = "script-binding select/select-audio-device; script-message-to osc osc-hide", volume_mbtn_right_command = "script-binding select/select-audio-device; script-message-to osc osc-hide",
volume_wheel_down_command = "add volume -5", volume_wheel_down_command = "add volume -5",
volume_wheel_up_command = "add volume 5", volume_wheel_up_command = "add volume 5",
fullscreen_mbtn_left_command = "cycle fullscreen",
fullscreen_mbtn_mid_command = "",
fullscreen_mbtn_right_command = "cycle window-maximized",
-- luacheck: pop -- luacheck: pop
} }
@ -1901,8 +1905,10 @@ local function osc_init()
return ("\238\132\136") return ("\238\132\136")
end end
end end
ne.eventresponder["mbtn_left_up"] = ne.eventresponder["mbtn_left_up"] = command_callback(user_opts.fullscreen_mbtn_left_command)
function () mp.commandv("cycle", "fullscreen") end ne.eventresponder["shift+mbtn_left_up"] = command_callback(
user_opts.fullscreen_mbtn_mid_command)
ne.eventresponder["mbtn_right_up"] = command_callback(user_opts.fullscreen_mbtn_right_command)
--seekbar --seekbar
ne = new_element("seekbar", "slider") ne = new_element("seekbar", "slider")