| @@ -119,6 +119,13 @@ local user_opts = { · 118 unmodified lines |
| 119 | 119 | -- luacheck: pop |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | +for i = 1, 99 do |
| 123 | + user_opts["custom_button_" .. i .. "_content"] = "" |
| 124 | + user_opts["custom_button_" .. i .. "_mbtn_left_command"] = "" |
| 125 | + user_opts["custom_button_" .. i .. "_mbtn_mid_command"] = "" |
| 126 | + user_opts["custom_button_" .. i .. "_mbtn_right_command"] = "" |
| 127 | +end |
| 128 | + |
| 122 | 129 | local osc_param = { -- calculated by osc_init() |
| 123 | 130 | playresy = 0, -- canvas size Y |
| 124 | 131 | playresx = 0, -- canvas size X |
| @@ -144,6 +151,7 @@ local window_control_box_width = 80 · 19 unmodified lines |
| 144 | 151 | local layouts = {} |
| 145 | 152 | local is_december = os.date("*t").month == 12 |
| 146 | 153 | local UNICODE_MINUS = string.char(0xe2, 0x88, 0x92) -- UTF-8 for U+2212 MINUS SIGN |
| 154 | +local last_custom_button = 0 |
| 147 | 155 | |
| 148 | 156 | local function osc_color_convert(color) |
| 149 | 157 | return color:sub(6,7) .. color:sub(4,5) .. color:sub(2,3) |
| @@ -1574,15 +1582,26 @@ local function bar_layout(direction) · 1424 unmodified lines |
| 1574 | 1582 | |
| 1575 | 1583 | local t_l = geo.x + geo.w + padX |
| 1576 | 1584 | |
| 1585 | + -- Custom buttons |
| 1586 | + local t_r = osc_geo.x + osc_geo.w |
| 1587 | + |
| 1588 | + for i = last_custom_button, 1, -1 do |
| 1589 | + t_r = t_r - padX |
| 1590 | + geo = { x = t_r, y = geo.y, an = 6, w = geo.w, h = geo.h } |
| 1591 | + t_r = t_r - geo.w |
| 1592 | + lo = add_layout("custom_button_" .. i) |
| 1593 | + lo.geometry = geo |
| 1594 | + lo.style = osc_styles.vidtitleBar |
| 1595 | + end |
| 1596 | + |
| 1577 | 1597 | -- Cache |
| 1578 | | − geo = { x = osc_geo.x + osc_geo.w - padX, y = geo.y, |
| 1579 | | − an = 6, w = 150, h = geo.h } |
| 1598 | + t_r = t_r - padX |
| 1599 | + geo = { x = t_r, y = geo.y, an = 6, w = 150, h = geo.h } |
| 1600 | + t_r = t_r - geo.w - padX |
| 1580 | 1601 | lo = add_layout("cache") |
| 1581 | 1602 | lo.geometry = geo |
| 1582 | 1603 | lo.style = osc_styles.vidtitleBar |
| 1583 | 1604 | |
| 1584 | | − local t_r = geo.x - geo.w - padX*2 |
| 1585 | | − |
| 1586 | 1605 | -- Title |
| 1587 | 1606 | geo = { x = t_l, y = geo.y, an = 4, |
| 1588 | 1607 | w = t_r - t_l, h = geo.h } |
| @@ -2065,6 +2084,19 @@ local function osc_init() · 476 unmodified lines |
| 2065 | 2084 | bind_mouse_buttons("volume") |
| 2066 | 2085 | |
| 2067 | 2086 | |
| 2087 | + -- custom buttons |
| 2088 | + for i = 1, math.huge do |
| 2089 | + local content = user_opts["custom_button_" .. i .. "_content"] |
| 2090 | + if not content or content == "" then |
| 2091 | + break |
| 2092 | + end |
| 2093 | + ne = new_element("custom_button_" .. i, "button") |
| 2094 | + ne.content = content |
| 2095 | + bind_mouse_buttons("custom_button_" .. i) |
| 2096 | + last_custom_button = i |
| 2097 | + end |
| 2098 | + |
| 2099 | + |
| 2068 | 2100 | -- load layout |
| 2069 | 2101 | layouts[user_opts.layout]() |
| 2070 | 2102 | |