Skip to content

Commit 66d774a

Browse files
committed
osc.lua: add osd-margin option
Fixes: #17539
1 parent 71cbbeb commit 66d774a

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
add `osc-dynamic_margins` option
22
add `osc-sub-margin` option
3+
add `osc-osd-margin` option

DOCS/man/osc.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,15 @@ Configurable Options
420420
already confined to the video area and this option has no additional
421421
effect.
422422

423+
``osd_margins``
424+
Default: yes
425+
426+
Whether to adjust ``--osd-margin-y`` so that OSD text does not overlap
427+
with the OSC. The offset is derived from the top OSC margin (including
428+
window controls when present) and added on top of the current
429+
``--osd-margin-y`` value. Requires ``dynamic_margins`` or
430+
``visibility=always`` to take effect.
431+
423432
``windowcontrols``
424433
Default: auto (Show window controls if there is no window border)
425434

player/lua/osc.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ local user_opts = {
5050
boxvideo = false, -- apply osc_param.video_margins to video
5151
dynamic_margins = false, -- update margins dynamically with OSC visibility
5252
sub_margins = true, -- adjust sub-margin-y to not overlap with OSC
53+
osd_margins = true, -- adjust osd-margin-y to not overlap with OSC
5354
windowcontrols = "auto", -- whether to show window controls
5455
windowcontrols_alignment = "right", -- which side to show window controls on
5556
windowcontrols_title = "${media-title}", -- same as title but for windowcontrols
@@ -562,6 +563,7 @@ local function reset_margins()
562563
state.using_video_margins = false
563564
end
564565
set_margin_offset("sub-margin-y", 0)
566+
set_margin_offset("osd-margin-y", 0)
565567
end
566568

567569
local function update_margins()
@@ -616,6 +618,7 @@ local function update_margins()
616618
return margin * osc_param.playresy
617619
end
618620
set_margin_offset("sub-margin-y", get_margin("sub"))
621+
set_margin_offset("osd-margin-y", get_margin("osd"))
619622

620623
mp.set_property_native("user-data/osc/margins", margins)
621624
end

0 commit comments

Comments
 (0)