diff --git a/init.lua b/init.lua index 6c3d941..cbce66b 100644 --- a/init.lua +++ b/init.lua @@ -247,7 +247,9 @@ local function get_dominant_color(client) end -- Returns a color that is analogous to the last color returned --- To make sure that the "randomly" generated colors look cohesive, only the first color is truly random, the rest are generated by offseting the hue by +33 degrees +-- To make sure that the "randomly" generated colors look cohesive, only the +-- first color is truly random, the rest are generated by offseting the hue by +-- +33 degrees local next_color = colors.rand_hex() local function get_next_color() local prev_color = next_color @@ -284,7 +286,8 @@ local function create_button_image(name, is_focused, event, is_on) if not is_focused and event ~= "hover" then button_color = colors.hsv2hex(H, 0, 50) end - -- Then the color is lightened if the button is being hovered over, or darkened if it is being pressed, otherwise it is left as is + -- Then the color is lightened if the button is being hovered over, or + -- darkened if it is being pressed, otherwise it is left as is button_color = (event == "hover") and colors.lighten(button_color, 25) or (event == "press") and colors.darken( button_color, @@ -312,7 +315,13 @@ local function create_titlebar_button(c, name, button_callback, property) if _private.tooltips_enabled then local tooltip = atooltip { timer_function = function() - return _private.tooltip_messages[name .. (property and (c[property] and "_active" or "_inactive") or "")] + local prop = name + .. ( + property + and (c[property] and "_active" or "_inactive") + or "" + ) + return _private.tooltip_messages[prop] end, delay_show = 0.5, margins_leftright = 12, @@ -409,7 +418,9 @@ local function get_titlebar_mouse_bindings(c) clicks = clicks + 1 if clicks == 2 then local nx, ny = _G.mouse.coords().x, _G.mouse.coords().y - -- The second click is only counted as a double click if it is within the neighborhood of the first click's position, and occurs within the set time window + -- The second click is only counted as a double click if it is + -- within the neighborhood of the first click's position, and + -- occurs within the set time window if abs(cx - nx) <= tolerance and abs(cy - ny) <= tolerance then if shade_enabled then _private.shade_roll_down(c) @@ -436,7 +447,7 @@ local function get_titlebar_mouse_bindings(c) end -- TODO: Add client control options as menu entries for options that haven't had their buttons added add_item("Redo Window Decorations", function() - c._nice_base_color = get_dominant_color(c) + c._nice_base_color = nice.get_dominant_color(c) set_color_rule(c, c._nice_base_color) _private.add_window_decorations(c) end)