Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Borders don't work in Dashboard #160

Open
mirunic15 opened this issue Oct 14, 2021 · 4 comments
Open

Borders don't work in Dashboard #160

mirunic15 opened this issue Oct 14, 2021 · 4 comments

Comments

@mirunic15
Copy link

I have been putting together my own rice and I wanted to incorporate a dashboard into it. I had never programmed in lua before and I wasn't too familiar with all of the functions of the awesome libraries so I used elenapan's dashboard configuration as a base.
The thing is that my theme has borders on almost all windows and wibar components and I was looking to add borders to the dashboard widget boxes as well, but they do not show up. I used the border_width and border_color properties of wibox.container.background(), which I have used for all of my other borders, but again they simply do not show up. I also tried adding them to some widgets inside the box containers, such as around the profile picture, and I have the same issue. I have no idea why this happens.

Here is my code for the create_boxed_widget() function, all I have added are lines 62 and 63, and a screenshot of how my dashboard looks with the respective code.

57 local function create_boxed_widget(widget_to_be_boxed, width, height, bg_color)
58     local box_container = wibox.container.background()
59     box_container.bg = bg_color
60     box_container.forced_height = height
61     box_container.forced_width = width  
62     box_container.border_width = beautiful.border_width
63     box_container.border_color = beautiful.border_color
64     box_container.shape = helpers.rrect(box_radius)
65     -- box_container.shape = helpers.prrect(20, true, true, true, true)
66     -- box_container.shape = helpers.prrect(30, true, true, false, true)
67     
68     local boxed_widget = wibox.widget {
69         -- Add margins
70         {
71             -- Add background color
72             {
73                 -- Center widget_to_be_boxed horizontally
74                 nil, 
75                 {   
76                     -- Center widget_to_be_boxed vertically
77                     nil, 
78                     -- The actual widget goes here
79                     widget_to_be_boxed,
80                     layout = wibox.layout.align.vertical,
81                     expand = "none" 
82                 },
83                 layout = wibox.layout.align.horizontal,
84                 expand = "none" 
85             },
86             widget = box_container,
87         },
88         margins = box_gap,
89         color = "#FF000000",
90         widget = wibox.container.margin
91     }
92      
93     return boxed_widget
94 end

dashboard
(ignore the uneven spacing and margins on the weather and uptime widgets, im still working on those)

This is my entire code btw, it is still a mess, but just in case it clarifies anything.
config.txt

@mirunic15
Copy link
Author

Update: I made a very shitty workaround to this, by adding essentially another background container on top of the existing one, but making it smaller, like this:

 58 local function create_boxed_widget(widget_to_be_boxed, width, height, bg_color, border_color)
 59     local box_container = wibox.container.background()
 60     box_container.bg = border_color
 61     box_container.forced_height = height
 62     box_container.forced_width = width
 63     box_container.border_width = beautiful.border_width
 64     box_container.border_color = beautiful.border_color
 65     box_container.shape = helpers.rrect(box_radius)
 66     -- box_container.shape = helpers.prrect(20, true, true, true, true)
 67     -- box_container.shape = helpers.prrect(30, true, true, false, true)
 68
 69     local boxed_widget = wibox.widget {
 70         -- Add margins
 71         {
 72             -- Add background color
 73             {
 74                 {
 75                     {
 76                         -- Center widget_to_be_boxed horizontally
 77                         nil,
 78                         {
 79                             -- Center widget_to_be_boxed vertically
 80                             nil,
 81                             -- The actual widget goes here
 82                             widget_to_be_boxed,
 83                             layout = wibox.layout.align.vertical,
 84                             expand = "none"
 85                         },
 86                         layout = wibox.layout.align.horizontal,
 87                         expand = "none"
 88                     },
 89                     widget = wibox.container.background,
 90                     bg = bg_color,
 91                     shape = helpers.rrect(box_radius-border_width),
 92                     forced_height = height-border_width,
 93                     fored_width = width-border_width,
 94                 },
 95                 margins = border_width,
 96                 widget = wibox.container.margin
 97             },
 98             widget = box_container,
 99         },
100         margins = box_gap,
101         color = "#FF000000",
102         widget = wibox.container.margin
103     }
104
105     return boxed_widget
106 end

I did this for every container where i wanted borders, and, well, it works.
image

@mirunic15
Copy link
Author

If anyone has any better solutions or any idea why wibox.container.background borders don't work with the dashboard, meaning a screen mask and a wibox, I would appreciate it if you could share :))

@elenapan
Copy link
Owner

Hi there,

I believe the problem is that beautiful.border_width is set to 0 in the theme you are using. For example, it works for me when I hardcode the width and color inside create_boxed_widget():

diff --git a/config/awesome/elemental/dashboard/amarena.lua b/config/awesome/elemental/dashboard/amarena.lua
index ff761c7..11c3b5a 100644
--- a/config/awesome/elemental/dashboard/amarena.lua
+++ b/config/awesome/elemental/dashboard/amarena.lua
@@ -55,6 +55,8 @@ local function create_boxed_widget(widget_to_be_boxed, width, height, bg_color)
     box_container.forced_height = height
     box_container.forced_width = width
     box_container.shape = helpers.rrect(box_radius)
+    box_container.border_width = 10
+    box_container.border_color = "#FF0000"
     -- box_container.shape = helpers.prrect(20, true, true, true, true)
     -- box_container.shape = helpers.prrect(30, true, true, false, true)

@mirunic15
Copy link
Author

Hello,
I am using a theme which has borders, they are visible on all of my client windows and the beautiful.border_width does work on any other container. I have re-checked and I do have the setting in theme.lua and I believe I have imported it correctly since other properties work.
I had also, and have now re-tried hardcoding the values and they still do not show up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants