Add 4 new theme variables.

It allows to configure the border of the focus/resize widget arrows.
This commit is contained in:
Emmanuel Lepage Vallee 2021-12-08 11:04:10 -08:00
parent 72c733b537
commit bd4f3de7f1
3 changed files with 53 additions and 43 deletions

View File

@ -23,7 +23,7 @@ First, clone the repository
git clone https://github.com/Elv13/collision 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) ~/.config/awesome/rc.lua fist if you never modified your Awesome config before)
and add this line somewhere in your `rc.lua`: and add this line somewhere in your `rc.lua`:
@ -97,33 +97,35 @@ namespace
## Focus ## Focus
| Variable | Description | | Variable | Description |
| :---------------------------: | ------------------------------------------------------ | | :---------------------------------: | ------------------------------------------------------ |
| collision_bg_focus | The background of the focus change arrow | | collision_resize_width | The size of the resize handles |
| collision_fg_focus | The foregroung filling color of the arrow | | collision_resize_shape | The gears.shape used for the resize handle |
| collision_bg_center | The focussed client circle background | | collision_resize_border_width | The resize handles border width |
| collision_resize_width | The size of the resize handles | | collision_resize_border_color | The resize handles border colors |
| collision_resize_shape | The gears.shape used for the resize handle | | collision_resize_padding | The resize handles padding between the boder and arrow |
| collision_resize_border_width | The resize handles border width | | collision_resize_bg | The resize handles background color |
| collision_resize_border_color | The resize handles border colors | | collision_resize_fg | The resize handles arrow color |
| collision_resize_padding | The resize handles padding between the boder and arrow | | collision_resize_arrow_border_color | The arrow border color |
| collision_resize_bg | The resize handles background color | | collision_resize_arrow_border_width | The arrow border width |
| collision_resize_fg | The resize handles arrow color | | collision_focus_shape | The outer shape of the "arrow" widgets |
| collision_focus_shape | | | collision_focus_border_width | |
| collision_focus_border_width | | | collision_focus_border_color | |
| collision_focus_border_color | | | collision_focus_padding | |
| collision_focus_padding | | | collision_focus_bg | The background of the focus change arrow |
| collision_focus_bg | | | collision_focus_fg | The foregroung filling color of the arrow |
| collision_focus_fg | | | collision_focus_bg_center | The focussed client circle background |
| collision_focus_bg_center | | | collision_focus_shape_center | The focused client widget shape (default: circle) |
| collision_screen_shape | | | collision_focus_arrow_border_color | The color of the arrow border |
| collision_screen_border_width | | | collision_focus_arrow_border_width | The width of the arrow border |
| collision_screen_border_color | | | collision_screen_shape | |
| collision_screen_padding | | | collision_screen_border_width | |
| collision_screen_bg | | | collision_screen_border_color | |
| collision_screen_fg | | | collision_screen_padding | |
| collision_screen_bg_focus | | | collision_screen_bg | |
| collision_screen_fg_focus | | | collision_screen_fg | |
| collision_screen_bg_focus | |
| collision_screen_fg_focus | |
# Settings # Settings

View File

@ -34,6 +34,8 @@ local function init()
local bg_focus = beautiful.collision_focus_bg_center or beautiful.bg_urgent or "#ff0000" local bg_focus = beautiful.collision_focus_bg_center or beautiful.bg_urgent or "#ff0000"
local sw = beautiful.collision_shape_width or 75 local sw = beautiful.collision_shape_width or 75
local sh = beautiful.collision_shape_height 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 local cshape = beautiful.collision_focus_shape_center or shape.circle
for k,v in ipairs({"up","right","down","left","center"}) do 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_shape = v == "center" and cshape or s
local r_bg = v == "center" and bg_focus or bg local r_bg = v == "center" and bg_focus or bg
local x = sw/2 - padding local x = (sw - arrow_bw*2)/2 - padding
local y = sh/2 - padding local y = (sh - arrow_bw*2)/2 - padding
wiboxes[v]:setup { wiboxes[v]:setup {
v ~= "center" and { v ~= "center" and {
@ -54,10 +56,12 @@ local function init()
{ {
widget = wibox.widget.imagebox 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), : rotate_at(x, y, (k-1)*(2*math.pi)/4),
bg = fg,
widget = wibox.container.background
}, },
margins = padding, margins = padding,
widget = wibox.container.margin, widget = wibox.container.margin,

View File

@ -29,13 +29,15 @@ local function create_indicators()
local angle = -((2*math.pi)/8) local angle = -((2*math.pi)/8)
-- Get the parameters -- Get the parameters
local size = beautiful.collision_resize_width or 40 local size = beautiful.collision_resize_width or 40
local s = beautiful.collision_resize_shape or shape.circle local s = beautiful.collision_resize_shape or shape.circle
local bw = beautiful.collision_resize_border_width local bw = beautiful.collision_resize_border_width
local bc = beautiful.collision_resize_border_color local bc = beautiful.collision_resize_border_color
local padding = beautiful.collision_resize_padding or 7 local padding = beautiful.collision_resize_padding or 7
local bg = beautiful.collision_resize_bg or beautiful.bg_alternate or "#ff0000" 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 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 for k,v in ipairs(values) do
local w = wibox { local w = wibox {
@ -47,7 +49,7 @@ local function create_indicators()
angle = angle + (2*math.pi)/8 angle = angle + (2*math.pi)/8
local tr = (size - 2*padding) / 2 local tr = (size - 2*arrow_bw - 2*padding) / 2
w:setup { w:setup {
{ {
@ -59,8 +61,10 @@ local function create_indicators()
: translate( tr,tr ) : translate( tr,tr )
: rotate ( angle ) : rotate ( angle )
: translate( -tr,-tr ), : translate( -tr,-tr ),
bg = fg, bg = fg,
widget = wibox.container.background border_color = arrow_bc,
border_width = arrow_bw,
widget = wibox.container.background
}, },
margins = padding, margins = padding,
widget = wibox.container.margin, widget = wibox.container.margin,