osc.lua: add osd-margin option

Fixes: #17539
This commit is contained in:
Kacper Michajłow committed 2026-03-10 19:45:03 +01:00
1 parent e1e6eb8b6e
commit 7b2feb9429
3 files changed
+13

No files matched your search

+1
View File
@@ -1,2 +1,3 @@
add `osc-dynamic_margins` option
add `osc-sub-margin` option
add `osc-osd-margin` option
+9
View File
@@ -420,6 +420,15 @@ Configurable Options
already confined to the video area and this option has no additional
effect.
``osd_margins``
Default: yes
Whether to adjust ``--osd-margin-y`` so that OSD text does not overlap
with the OSC. The offset is derived from the top OSC margin (including
window controls when present) and added on top of the current
``--osd-margin-y`` value. Requires ``dynamic_margins`` or
``visibility=always`` to take effect.
``windowcontrols``
Default: auto (Show window controls if there is no window border)
+3
View File
@@ -50,6 +50,7 @@ local user_opts = {
boxvideo = false, -- apply osc_param.video_margins to video
dynamic_margins = false, -- update margins dynamically with OSC visibility
sub_margins = true, -- adjust sub-margin-y to not overlap with OSC
osd_margins = true, -- adjust osd-margin-y to not overlap with OSC
windowcontrols = "auto", -- whether to show window controls
windowcontrols_alignment = "right", -- which side to show window controls on
windowcontrols_title = "${media-title}", -- same as title but for windowcontrols
@@ -562,6 +563,7 @@ local function reset_margins()
state.using_video_margins = false
end
set_margin_offset("sub-margin-y", 0)
set_margin_offset("osd-margin-y", 0)
end
local function update_margins()
@@ -616,6 +618,7 @@ local function update_margins()
return margin * osc_param.playresy
end
set_margin_offset("sub-margin-y", get_margin("sub"))
set_margin_offset("osd-margin-y", get_margin("osd"))
mp.set_property_native("user-data/osc/margins", margins)
end