This commit is contained in:
2026-04-03 11:33:51 +02:00
parent 64922e1ae3
commit 0ed904319d
57 changed files with 2935 additions and 1377 deletions
+11 -10
View File
@@ -21,11 +21,17 @@ function TopBar:init()
self.current_chapter = nil
local function maximized_command()
mp.command(state.fullormaxed and 'set fullscreen no;set window-maximized no' or 'set window-maximized yes')
if state.platform == 'windows' then
mp.command(state.border
and (state.fullscreen and 'set fullscreen no;cycle window-maximized' or 'cycle window-maximized')
or 'set window-maximized no;cycle fullscreen')
else
mp.command(state.fullormaxed and 'set fullscreen no;set window-maximized no' or 'set window-maximized yes')
end
end
local close = {icon = 'close', hover_bg = '2311e8', hover_fg = 'ffffff', command = function() mp.command('quit') end}
local max = {icon = 'crop_square', command = maximized_command, is_max = true}
local max = {icon = 'crop_square', command = maximized_command}
local min = {icon = 'minimize', command = function() mp.command('cycle window-minimized') end}
self.buttons = options.top_bar_controls == 'left' and {close, max, min} or {min, max, close}
@@ -237,13 +243,8 @@ function TopBar:render()
end
for _, button in ipairs(self.buttons) do
if button.is_max then
button.icon = state.fullscreen and 'close_fullscreen' or
(state.maximized and 'filter_none' or 'crop_square')
end
local rect = {ax = button_ax, ay = ay, bx = button_ax + self.size, by = by}
local is_hover = get_point_to_rectangle_proximity(cursor, rect) == 0
local is_hover = get_point_to_rectangle_proximity(cursor, rect) <= 0
local opacity = is_hover and 1 or config.opacity.controls
local button_fg = is_hover and (button.hover_fg or bg) or fg
local button_bg = is_hover and (button.hover_bg or fg) or bg
@@ -290,7 +291,7 @@ function TopBar:render()
bx = ax + rect_width,
by = by - margin,
}
local opacity = get_point_to_rectangle_proximity(cursor, rect) == 0
local opacity = get_point_to_rectangle_proximity(cursor, rect) <= 0
and 1 or config.opacity.playlist_position
if opacity > 0 then
ass:rect(rect.ax, rect.ay, rect.bx, rect.by, {
@@ -427,4 +428,4 @@ function TopBar:render()
return ass
end
return TopBar
return TopBar