diff options
author | Joe <rrbo@proton.me> | 2023-01-31 14:03:59 +0100 |
---|---|---|
committer | Joe <rrbo@proton.me> | 2023-01-31 14:03:59 +0100 |
commit | efa2957045fe9ea4421ea4a0c546f62a8a27fb58 (patch) | |
tree | 816b267a9d431e28744db41429358516ab0c461b /.config/mpv/scripts/uosc_shared/elements/WindowBorder.lua | |
parent | up (diff) | |
download | dotfiles-bsd-efa2957045fe9ea4421ea4a0c546f62a8a27fb58.tar.gz dotfiles-bsd-efa2957045fe9ea4421ea4a0c546f62a8a27fb58.tar.bz2 dotfiles-bsd-efa2957045fe9ea4421ea4a0c546f62a8a27fb58.tar.xz dotfiles-bsd-efa2957045fe9ea4421ea4a0c546f62a8a27fb58.tar.zst dotfiles-bsd-efa2957045fe9ea4421ea4a0c546f62a8a27fb58.zip |
update
Diffstat (limited to '.config/mpv/scripts/uosc_shared/elements/WindowBorder.lua')
-rw-r--r-- | .config/mpv/scripts/uosc_shared/elements/WindowBorder.lua | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/.config/mpv/scripts/uosc_shared/elements/WindowBorder.lua b/.config/mpv/scripts/uosc_shared/elements/WindowBorder.lua new file mode 100644 index 0000000..c5544f5 --- /dev/null +++ b/.config/mpv/scripts/uosc_shared/elements/WindowBorder.lua @@ -0,0 +1,33 @@ +local Element = require('uosc_shared/elements/Element') + +---@class WindowBorder : Element +local WindowBorder = class(Element) + +function WindowBorder:new() return Class.new(self) --[[@as WindowBorder]] end +function WindowBorder:init() + Element.init(self, 'window_border') + self.ignores_menu = true + self.size = 0 +end + +function WindowBorder:decide_enabled() + self.enabled = options.window_border_size > 0 and not state.fullormaxed and not state.border + self.size = self.enabled and options.window_border_size or 0 +end + +function WindowBorder:on_prop_border() self:decide_enabled() end +function WindowBorder:on_prop_fullormaxed() self:decide_enabled() end + +function WindowBorder:render() + if self.size > 0 then + local ass = assdraw.ass_new() + local clip = '\\iclip(' .. self.size .. ',' .. self.size .. ',' .. + (display.width - self.size) .. ',' .. (display.height - self.size) .. ')' + ass:rect(0, 0, display.width + 1, display.height + 1, { + color = bg, clip = clip, opacity = options.window_border_opacity, + }) + return ass + end +end + +return WindowBorder |