From 315edd47753666ce28aa1bb83412dbaa014b9cef Mon Sep 17 00:00:00 2001 From: Guido Cella Date: Tue, 10 Mar 2026 16:50:50 +0100 Subject: [PATCH] console.lua: use the default OSD margins when OSC margins are set The OSC (with #17544) and uosc increase --osd-margin-y along with user-data/osc/margins to not overlap with OSD messages, which positions console far apart form the bottom. Fix this by using the default --osd-margin-{x,y} when OSC margins are set. Fixes https://github.com/mpv-player/mpv/pull/15334#issuecomment-2755892945 --- player/lua/console.lua | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/player/lua/console.lua b/player/lua/console.lua index 074ff68573bc5..5495519e2ecf1 100644 --- a/player/lua/console.lua +++ b/player/lua/console.lua @@ -160,11 +160,27 @@ local function get_font() end local function get_margin_x() - return opts.margin_x > -1 and opts.margin_x or mp.get_property_native("osd-margin-x") + if opts.margin_x > -1 then + return opts.margin_x + end + + if global_margins.t > 0 or global_margins.b > 0 then + return mp.get_property_native("option-info/osd-margin-x/default-value") + end + + return mp.get_property_native("osd-margin-x") end local function get_margin_y() - return opts.margin_y > -1 and opts.margin_y or mp.get_property_native("osd-margin-y") + if opts.margin_y > -1 then + return opts.margin_y + end + + if global_margins.t > 0 or global_margins.b > 0 then + return mp.get_property_native("option-info/osd-margin-y/default-value") + end + + return mp.get_property_native("osd-margin-y") end