Use media-title instead of filename for window title
This commit is contained in:
13
uosc.lua
13
uosc.lua
@@ -244,7 +244,7 @@ local state = {
|
||||
return 'linux'
|
||||
end)(),
|
||||
cwd = mp.get_property('working-directory'),
|
||||
filename = '',
|
||||
media_title = '',
|
||||
border = mp.get_property_native('border'),
|
||||
duration = nil,
|
||||
position = nil,
|
||||
@@ -1413,7 +1413,7 @@ function render_window_controls(this)
|
||||
ass:draw_stop()
|
||||
|
||||
-- Window title
|
||||
if options.title then
|
||||
if options.title and state.media_title then
|
||||
local spacing = math.ceil(config.window_controls.height * 0.25)
|
||||
local fontsize = math.floor(config.window_controls.height - (spacing * 2))
|
||||
local clip_coordinates = '0,0,'..(minimize.ax - spacing)..','..config.window_controls.height
|
||||
@@ -1423,7 +1423,7 @@ function render_window_controls(this)
|
||||
ass:append(ass_opacity(1, opacity))
|
||||
ass:pos(0 + spacing, config.window_controls.height / 2)
|
||||
ass:an(4)
|
||||
ass:append(state.filename)
|
||||
ass:append(state.media_title)
|
||||
end
|
||||
|
||||
return ass
|
||||
@@ -2256,12 +2256,9 @@ options.subtitle_types = split(options.subtitle_types, ' *, *')
|
||||
|
||||
-- HOOKS
|
||||
|
||||
mp.register_event('file-loaded', function()
|
||||
state.duration = mp.get_property_number('duration', nil)
|
||||
state.filename = mp.get_property_osd('filename', '')
|
||||
end)
|
||||
|
||||
mp.observe_property('chapter-list', 'native', parse_chapters)
|
||||
mp.observe_property('duration', 'number', create_state_setter('duration'))
|
||||
mp.observe_property('media-title', 'string', create_state_setter('media_title'))
|
||||
mp.observe_property('fullscreen', 'bool', create_state_setter('fullscreen'))
|
||||
mp.observe_property('window-maximized', 'bool', create_state_setter('maximized'))
|
||||
mp.observe_property('idle-active', 'bool', create_state_setter('idle'))
|
||||
|
Reference in New Issue
Block a user