Skip to content

Commit

Permalink
osc.lua: add showlogo and showidlemsg options
Browse files Browse the repository at this point in the history
This is mainly for other user scripts that may conflict with the osc
logo in some way. While you can use script-message and
shared-script-properties (highly discouraged in the documentation for
some reason) to work around this, there's still some brittle edge cases
and complicated logic that can pop up. Adding an option for these two
things (the logo and the "drop files..." text) is really trivial and
would make things easier for scripts. Discussed in a couple of issues
below:
mpv-player#10201
CogentRedTester/mpv-file-browser#55
  • Loading branch information
Dudemanguy committed May 19, 2022
1 parent f20dbcd commit e814280
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
10 changes: 10 additions & 0 deletions DOCS/man/osc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,16 @@ Configurable Options

Enable the OSC when fullscreen

``showlogo``
Default: yes

Show the mpv logo when idle

``showidlemsg``
Default: yes

Show the "Drop files..." message when idle.

``scalewindowed``
Default: 1.0

Expand Down
20 changes: 13 additions & 7 deletions player/lua/osc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ local utils = require 'mp.utils'
local user_opts = {
showwindowed = true, -- show OSC when windowed?
showfullscreen = true, -- show OSC when fullscreen?
showlogo = true, -- show mpv logo on idle
showidlemsg = true, -- show the "drop files" msg on idle
scalewindowed = 1, -- scaling of the controller when windowed
scalefullscreen = 1, -- scaling of the controller when fullscreen
scaleforcedwindow = 2, -- scaling when rendered on a forced window
Expand Down Expand Up @@ -2579,9 +2581,11 @@ function tick()

local ass = assdraw.ass_new()
-- mpv logo
for i, line in ipairs(logo_lines) do
ass:new_event()
ass:append(line_prefix .. line)
if user_opts.showlogo then
for i, line in ipairs(logo_lines) do
ass:new_event()
ass:append(line_prefix .. line)
end
end

-- Santa hat
Expand All @@ -2592,10 +2596,12 @@ function tick()
end
end

ass:new_event()
ass:pos(320, icon_y+65)
ass:an(8)
ass:append("Drop files or URLs to play here.")
if user_opts.showidlemsg then
ass:new_event()
ass:pos(320, icon_y+65)
ass:an(8)
ass:append("Drop files or URLs to play here.")
end
set_osd(640, 360, ass.text)

if state.showhide_enabled then
Expand Down

0 comments on commit e814280

Please sign in to comment.