From 19b0666a687fb5df10acc8049c4bb68921eed4c5 Mon Sep 17 00:00:00 2001 From: hooke007 Date: Thu, 20 Oct 2022 00:01:56 +0100 Subject: [PATCH] =?UTF-8?q?=E8=84=9A=E6=9C=AC=EF=BC=9A=20uosc=20=E6=94=B9?= =?UTF-8?q?=E8=BF=9B=E8=8F=9C=E5=8D=95=E4=B8=AD=E7=9A=84=E6=88=AA=E5=B1=8F?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/hooke007/MPV_lazy/issues/196 --- portable_config/input_uosc.conf | 2 +- portable_config/scripts/uosc.lua | 28 +++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/portable_config/input_uosc.conf b/portable_config/input_uosc.conf index 3b13d90b..b9624348 100644 --- a/portable_config/input_uosc.conf +++ b/portable_config/input_uosc.conf @@ -13,7 +13,7 @@ # script-binding uosc/subtitles #! 导航 > ※ 字幕轨列表 # playlist-shuffle #! 导航 > 播放列表乱序重排 -# screenshot window #! 截屏 当前画面 +# script-binding uosc/shot #! ※ 截屏 # cycle-values hwdec "auto" "auto-copy" "no" #! 视频 > 切换 解码模式 # cycle deband #! 视频 > 切换 去色带状态 diff --git a/portable_config/scripts/uosc.lua b/portable_config/scripts/uosc.lua index 762edea2..f1197072 100644 --- a/portable_config/scripts/uosc.lua +++ b/portable_config/scripts/uosc.lua @@ -267,7 +267,7 @@ local function create_default_menu() {title = '※ 字幕轨列表', value = 'script-binding uosc/subtitles'}, {title = '播放列表乱序重排', value = 'playlist-shuffle'}, },}, - {title = '截屏 当前画面', value = 'screenshot window'}, + {title = '※ 截屏', value = 'script-binding uosc/shot'}, {title = '视频', items = { {title = '切换 解码模式', value = 'cycle-values hwdec no auto auto-copy'}, {title = '切换 去色带状态', value = 'cycle deband'}, @@ -4773,6 +4773,32 @@ mp.add_key_binding(nil, 'open-config-directory', function() msg.error('Couldn\'t serialize config path "' .. config_path .. '".') end end) +-- 菜单专用截屏 +mp.add_key_binding(nil, 'shot', function() + if Menu:is_open() then + local bak_opt1, bak_opt2, bak_opt3, bak_opt4 = options.curtain_opacity, options.menu_opacity, options.menu_parent_opacity, options.pause_indicator + options.curtain_opacity, options.menu_opacity, options.menu_parent_opacity = 0, 0, 0 + -- 并非所有元素支持透明 + local paused = mp.get_property_bool('pause') + if paused then + mp.add_timeout(200 / 1000, function() -- 延迟过低可能产生闪烁 + mp.command('screenshot window') + options.curtain_opacity, options.menu_opacity, options.menu_parent_opacity = bak_opt1, bak_opt2, bak_opt3 + end) + else + options.pause_indicator = 'manual' + mp.set_property_bool('pause', true) + mp.add_timeout(200 / 1000, function() + mp.command('screenshot window') + mp.set_property_bool('pause', false) + options.pause_indicator = bak_opt4 + options.curtain_opacity, options.menu_opacity, options.menu_parent_opacity = bak_opt1, bak_opt2, bak_opt3 + end) + end + else + mp.command('screenshot window') + end +end) -- 空闲自动弹出上下文菜单 if type(options.idle_call_menu) == 'number' then