@@ -126,7 +126,7 @@ pause_indicator=flash
|
||||
# window controls (minimize, maximize, close, title) show only in no-border
|
||||
# mode, but you can disable them completely by setting this to `no`
|
||||
window_controls=yes
|
||||
# display current media title in top window controls bar
|
||||
# display current media title in top bar in no-border mode
|
||||
title=no
|
||||
# load first file when calling next on a last file in a directory and vice versa
|
||||
directory_navigation_loops=no
|
||||
|
@@ -74,7 +74,7 @@ pause_indicator=flash
|
||||
# window controls (minimize, maximize, close, title) show only in no-border
|
||||
# mode, but you can disable them completely by setting this to `no`
|
||||
window_controls=yes
|
||||
# display current media title in top window controls bar
|
||||
# display current media title in top bar in no-border mode
|
||||
title=no
|
||||
# load first file when calling next on a last file in a directory and vice versa
|
||||
directory_navigation_loops=no
|
||||
|
21
uosc.lua
21
uosc.lua
@@ -95,7 +95,7 @@ pause_indicator=flash
|
||||
# window controls (minimize, maximize, close, title) show only in no-border
|
||||
# mode, but you can disable them completely by setting this to `no`
|
||||
window_controls=yes
|
||||
# display current media title in top window controls bar
|
||||
# display current media title in top bar in no-border mode
|
||||
title=no
|
||||
# load first file when calling next on a last file in a directory and vice versa
|
||||
directory_navigation_loops=no
|
||||
@@ -1575,13 +1575,14 @@ function render_timeline(this)
|
||||
return ass
|
||||
end
|
||||
|
||||
function render_window_controls(this)
|
||||
function render_top_bar(this)
|
||||
local opacity = this:get_effective_proximity()
|
||||
|
||||
if not this.enabled or opacity == 0 then return end
|
||||
|
||||
local ass = assdraw.ass_new()
|
||||
|
||||
if options.window_controls then
|
||||
-- Close button
|
||||
local close = elements.window_controls_close
|
||||
if close.proximity_raw == 0 then
|
||||
@@ -1653,12 +1654,13 @@ function render_window_controls(this)
|
||||
ass:move_to(-5, 0)
|
||||
ass:line_to(5, 0)
|
||||
ass:draw_stop()
|
||||
end
|
||||
|
||||
-- Window title
|
||||
if options.title and state.media_title then
|
||||
local spacing = math.ceil(config.window_controls.height * 0.25)
|
||||
local font_size = math.floor(config.window_controls.height - (spacing * 2))
|
||||
local clip_coordinates = '0,0,'..(minimize.ax - spacing)..','..config.window_controls.height
|
||||
local clip_coordinates = '0,0,'..(this.title_bx - spacing)..','..config.window_controls.height
|
||||
|
||||
ass:new_event()
|
||||
ass:append('{\\q2\\blur0\\bord1\\shad0\\1c&HFFFFFF\\3c&H000000\\fn'..config.font..'\\fs'..font_size..bold_tag..'\\clip('..clip_coordinates..')')
|
||||
@@ -2221,8 +2223,8 @@ elements:add('timeline', Element.new({
|
||||
end,
|
||||
render = render_timeline,
|
||||
}))
|
||||
if options.window_controls then
|
||||
elements:add('window_controls', Element.new({
|
||||
if options.window_controls or options.title then
|
||||
elements:add('top_bar', Element.new({
|
||||
enabled = false,
|
||||
init = function(this)
|
||||
mp.observe_property('border', 'bool', function(_, border)
|
||||
@@ -2234,13 +2236,16 @@ if options.window_controls then
|
||||
return this.forced_proximity and this.forced_proximity or this.proximity
|
||||
end,
|
||||
on_display_resize = function(this)
|
||||
this.ax = options.title and 0 or (display.width - (config.window_controls.button_width * 3))
|
||||
this.title_bx = display.width - (config.window_controls.button_width * 3)
|
||||
this.ax = options.title and 0 or this.title_bx
|
||||
this.ay = 0
|
||||
this.bx = display.width
|
||||
this.by = config.window_controls.height
|
||||
end,
|
||||
render = render_window_controls,
|
||||
render = render_top_bar,
|
||||
}))
|
||||
end
|
||||
if options.window_controls then
|
||||
elements:add('window_controls_minimize', Element.new({
|
||||
captures = {mouse_buttons = true},
|
||||
on_display_resize = function(this)
|
||||
@@ -2689,7 +2694,7 @@ end
|
||||
|
||||
function handle_mouse_leave()
|
||||
-- Slowly fadeout elements that are currently visible
|
||||
for _, element_name in ipairs({'timeline', 'volume', 'window_controls'}) do
|
||||
for _, element_name in ipairs({'timeline', 'volume', 'top_bar'}) do
|
||||
local element = elements[element_name]
|
||||
if element and element.proximity > 0 then
|
||||
element:tween_property('forced_proximity', element:get_effective_proximity(), 0, function()
|
||||
|
Reference in New Issue
Block a user