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

Dashboard user profile image not shown correctly and my workaround. #131

Open
smb374 opened this issue Nov 23, 2020 · 1 comment
Open

Dashboard user profile image not shown correctly and my workaround. #131

smb374 opened this issue Nov 23, 2020 · 1 comment

Comments

@smb374
Copy link

smb374 commented Nov 23, 2020

There's some problem of the profile image in the dash board, as the screenshot below shown:
original in repo
The frame is not correctly clip to my profile image.
After some research, I fixed it:
work around

My workaround:
amarena.diff:

diff --git a/./amarena_original.lua b/amarena.lua
index aa234c8..611e9ed 100644
--- a/./amarena_original.lua
+++ b/amarena.lua
@@ -88,19 +88,24 @@ end
 
 
 
--- User widget
-local user_picture_container = wibox.container.background()
--- user_picture_container.shape = gears.shape.circle
-user_picture_container.shape = helpers.prrect(dpi(40), true, true, false, true)
-user_picture_container.forced_height = dpi(140)
-user_picture_container.forced_width = dpi(140)
 local user_picture = wibox.widget {
     {
-        wibox.widget.imagebox(user.profile_picture),
-        widget = user_picture_container
+        {
+            {
+                widget = wibox.widget.imagebox,
+                image = user.profile_picture,
+                clip_shape = helpers.rrect(box_radius / 2),
+            },
+            shape = helpers.prrect(dpi(40), true, true, false, true),
+            layout = wibox.container.background
+        },
+        halign = 'center',
+        valign = 'center',
+        layout = wibox.container.place
     },
-    shape = helpers.rrect(box_radius / 2),
-    widget = wibox.container.background
+    height = dpi(140),
+    width = dpi(140),
+    layout = wibox.container.constraint
 }
 local username = os.getenv("USER")
 local user_text = wibox.widget.textbox(username:upper())

It seems like wibox.container.background will auto stretch to fit the width while the imagebox remains at its original place, left aligned.
As a result, the visual effect will be like the one shown in the first screenshot.
My approach is to use wibox.container.place to place it at the center and use wibox.container.constraint to limit its max size rather than using forced_width & forced_hight for a better visual effect.

=====
*EDIT:
Sorry for the instant reopen issue, I mis-hit my enter key :(

@smb374 smb374 closed this as completed Nov 23, 2020
@smb374 smb374 reopened this Nov 23, 2020
@jasoneliu
Copy link

I had the same issue. Your solution worked for me too. Thanks!

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

3 participants