From bd4f3de7f1b711e69a84976c2f803f814a0c24ac Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Wed, 8 Dec 2021 11:04:10 -0800 Subject: [PATCH] Add 4 new theme variables. It allows to configure the border of the focus/resize widget arrows. --- README.md | 58 ++++++++++++++++++++++++++++-------------------------- focus.lua | 14 ++++++++----- resize.lua | 24 ++++++++++++---------- 3 files changed, 53 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index 4d369d8..748faa5 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ First, clone the repository git clone https://github.com/Elv13/collision ``` -Now, open ~/.config/awesome/rc.lua (or copy /etc/xdg/awesome/rc.lua to +Now, open ~/.config/awesome/rc.lua (or copy /etc/xdg/awesome/rc.lua to ~/.config/awesome/rc.lua fist if you never modified your Awesome config before) and add this line somewhere in your `rc.lua`: @@ -97,33 +97,35 @@ namespace ## Focus -| Variable | Description | -| :---------------------------: | ------------------------------------------------------ | -| collision_bg_focus | The background of the focus change arrow | -| collision_fg_focus | The foregroung filling color of the arrow | -| collision_bg_center | The focussed client circle background | -| collision_resize_width | The size of the resize handles | -| collision_resize_shape | The gears.shape used for the resize handle | -| collision_resize_border_width | The resize handles border width | -| collision_resize_border_color | The resize handles border colors | -| collision_resize_padding | The resize handles padding between the boder and arrow | -| collision_resize_bg | The resize handles background color | -| collision_resize_fg | The resize handles arrow color | -| collision_focus_shape | | -| collision_focus_border_width | | -| collision_focus_border_color | | -| collision_focus_padding | | -| collision_focus_bg | | -| collision_focus_fg | | -| collision_focus_bg_center | | -| collision_screen_shape | | -| collision_screen_border_width | | -| collision_screen_border_color | | -| collision_screen_padding | | -| collision_screen_bg | | -| collision_screen_fg | | -| collision_screen_bg_focus | | -| collision_screen_fg_focus | | +| Variable | Description | +| :---------------------------------: | ------------------------------------------------------ | +| collision_resize_width | The size of the resize handles | +| collision_resize_shape | The gears.shape used for the resize handle | +| collision_resize_border_width | The resize handles border width | +| collision_resize_border_color | The resize handles border colors | +| collision_resize_padding | The resize handles padding between the boder and arrow | +| collision_resize_bg | The resize handles background color | +| collision_resize_fg | The resize handles arrow color | +| collision_resize_arrow_border_color | The arrow border color | +| collision_resize_arrow_border_width | The arrow border width | +| collision_focus_shape | The outer shape of the "arrow" widgets | +| collision_focus_border_width | | +| collision_focus_border_color | | +| collision_focus_padding | | +| collision_focus_bg | The background of the focus change arrow | +| collision_focus_fg | The foregroung filling color of the arrow | +| collision_focus_bg_center | The focussed client circle background | +| collision_focus_shape_center | The focused client widget shape (default: circle) | +| collision_focus_arrow_border_color | The color of the arrow border | +| collision_focus_arrow_border_width | The width of the arrow border | +| collision_screen_shape | | +| collision_screen_border_width | | +| collision_screen_border_color | | +| collision_screen_padding | | +| collision_screen_bg | | +| collision_screen_fg | | +| collision_screen_bg_focus | | +| collision_screen_fg_focus | | # Settings diff --git a/focus.lua b/focus.lua index b7fd8b0..7af4c94 100644 --- a/focus.lua +++ b/focus.lua @@ -34,6 +34,8 @@ local function init() local bg_focus = beautiful.collision_focus_bg_center or beautiful.bg_urgent or "#ff0000" local sw = beautiful.collision_shape_width or 75 local sh = beautiful.collision_shape_height or 75 + local arrow_bc = beautiful.collision_focus_arrow_border_color + local arrow_bw = beautiful.collision_focus_arrow_border_width or 0 local cshape = beautiful.collision_focus_shape_center or shape.circle for k,v in ipairs({"up","right","down","left","center"}) do @@ -45,8 +47,8 @@ local function init() local r_shape = v == "center" and cshape or s local r_bg = v == "center" and bg_focus or bg - local x = sw/2 - padding - local y = sh/2 - padding + local x = (sw - arrow_bw*2)/2 - padding + local y = (sh - arrow_bw*2)/2 - padding wiboxes[v]:setup { v ~= "center" and { @@ -54,10 +56,12 @@ local function init() { widget = wibox.widget.imagebox }, - shape = shape.transform(col_utils.arrow_path2) + bg = fg, + border_color = arrow_bc, + border_width = arrow_bw, + widget = wibox.container.background, + shape = shape.transform(col_utils.arrow_path2) : rotate_at(x, y, (k-1)*(2*math.pi)/4), - bg = fg, - widget = wibox.container.background }, margins = padding, widget = wibox.container.margin, diff --git a/resize.lua b/resize.lua index a03433d..61179e7 100644 --- a/resize.lua +++ b/resize.lua @@ -29,13 +29,15 @@ local function create_indicators() local angle = -((2*math.pi)/8) -- Get the parameters - local size = beautiful.collision_resize_width or 40 - local s = beautiful.collision_resize_shape or shape.circle - local bw = beautiful.collision_resize_border_width - local bc = beautiful.collision_resize_border_color - local padding = beautiful.collision_resize_padding or 7 - local bg = beautiful.collision_resize_bg or beautiful.bg_alternate or "#ff0000" - local fg = beautiful.collision_resize_fg or beautiful.fg_normal or "#0000ff" + local size = beautiful.collision_resize_width or 40 + local s = beautiful.collision_resize_shape or shape.circle + local bw = beautiful.collision_resize_border_width + local bc = beautiful.collision_resize_border_color + local padding = beautiful.collision_resize_padding or 7 + local bg = beautiful.collision_resize_bg or beautiful.bg_alternate or "#ff0000" + local fg = beautiful.collision_resize_fg or beautiful.fg_normal or "#0000ff" + local arrow_bc = beautiful.collision_resize_arrow_border_color + local arrow_bw = beautiful.collision_resize_arrow_border_width or 0 for k,v in ipairs(values) do local w = wibox { @@ -47,7 +49,7 @@ local function create_indicators() angle = angle + (2*math.pi)/8 - local tr = (size - 2*padding) / 2 + local tr = (size - 2*arrow_bw - 2*padding) / 2 w:setup { { @@ -59,8 +61,10 @@ local function create_indicators() : translate( tr,tr ) : rotate ( angle ) : translate( -tr,-tr ), - bg = fg, - widget = wibox.container.background + bg = fg, + border_color = arrow_bc, + border_width = arrow_bw, + widget = wibox.container.background }, margins = padding, widget = wibox.container.margin,