multilockscreen
multilockscreen copied to clipboard
Incorrect box size
The box that is normally around the clock and ring only extends to the bottom right of the clock for me and does not include the text or the ring.
Also, are you planning on maintaining this fork indefinitely, or do you want to merge it back into betterlockscreen at some point? Are you accepting feature requests, and would you find a code review of the current code useful?
The box that is normally around the clock and ring only extends to the bottom right of the clock for me and does not include the text or the ring.
That's strange. The size of the box is hardcoded to 300x80 in create_loginbox(). Can you share the output of xrandr and xdpyinfo | grep soultion? Also, are you using display_on and span_image in the config, or using the arguments --display and --span?
Also, are you planning on maintaining this fork indefinitely, or do you want to merge it back into betterlockscreen at some point?
That's still TDB I guess. I would certainly rather give back to betterlockscreen, but we'll have to see where things are if and when they decide to merge multi-monitor.
Are you accepting feature requests, and would you find a code review of the current code useful?
I'm open to suggestions and PRs, but at moment I will probably only want to add new imagemagick effects.
I'm not using any settings or those flags. My screen is 4k, and I am setting xrandr --dpi 192 in my .xinitrc, which seems to be the issue. If I run xrandr --dpi 96, the box seems to be the correct size, but it is too high.
xdpyinfo | grep solution output: resolution: 193x193 dots per inch
xrandr output:
Screen 0: minimum 8 x 8, current 3840 x 2160, maximum 32767 x 32767
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
HDMI-0 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 disconnected (normal left inverted right x axis y axis)
eDP-1-1 connected primary 3840x2160+0+0 (normal left inverted right x axis y axis) 344mm x 193mm
3840x2160 60.00*+ 59.98 59.97
3200x1800 59.96 59.94
2880x1620 59.96 59.97
2560x1600 59.99 59.97
2560x1440 59.99 59.99 59.96 59.95
2048x1536 60.00
1920x1440 60.00
1856x1392 60.01
1792x1344 60.01
2048x1152 59.99 59.98 59.90 59.91
1920x1200 59.88 59.95
1920x1080 60.01 59.97 59.96 59.93
1600x1200 60.00
1680x1050 59.95 59.88
1400x1050 59.98
1600x900 59.99 59.94 59.95 59.82
1280x1024 60.02
1400x900 59.96 59.88
1280x960 60.00
1440x810 60.00 59.97
1368x768 59.88 59.85
1280x800 59.99 59.97 59.81 59.91
1280x720 60.00 59.99 59.86 59.74
1024x768 60.04 60.00
960x720 60.00
928x696 60.05
896x672 60.01
1024x576 59.95 59.96 59.90 59.82
960x600 59.93 60.00
960x540 59.96 59.99 59.63 59.82
800x600 60.00 60.32 56.25
840x525 60.01 59.88
864x486 59.92 59.57
700x525 59.98
800x450 59.95 59.82
640x512 60.02
700x450 59.96 59.88
640x480 60.00 59.94
720x405 59.51 58.99
684x384 59.88 59.85
640x400 59.88 59.98
640x360 59.86 59.83 59.84 59.32
512x384 60.00
512x288 60.00 59.92
480x270 59.63 59.82
400x300 60.32 56.34
432x243 59.92 59.57
320x240 60.05
360x202 59.51 59.13
You can try tweaking the values passed to logical_px() on lines 368-369
rect_x=$((pos_x + $(logical_px 15 1)))
rect_y=$((pos_y + res_y - $(logical_px 120 2)))
I'll have to add an option to adjust these values in the config
pavanjadhaw/betterlockscreen#144
I guess it needs to correctly take the dpi into account. Ideally the box can be correct without configuration. I can look into this on my machine at some point.
The box just needs to use logical_px too (e.g. convert -size $(logical_px 300 1)x$(logical_px 80 2)). That fixes this.
seems like I'm still affected by this issue

@minhduc0711 Can you post output of xrandr and xdpyinfo | grep resolution? Also your config file if you're using one.
@jeffmhubbard I'm not using a config file.
Here's the output of xrandr
Screen 0: minimum 320 x 200, current 3840 x 1080, maximum 16384 x 16384
eDP-1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 344mm x 193mm
1920x1080 60.01*+ 60.01 59.97 59.96 59.93
1680x1050 59.95 59.88
1600x1024 60.17
1400x1050 59.98
1600x900 59.99 59.94 59.95 59.82
1280x1024 60.02
1440x900 59.89
1400x900 59.96 59.88
1280x960 60.00
1440x810 60.00 59.97
1368x768 59.88 59.85
1360x768 59.80 59.96
1280x800 59.99 59.97 59.81 59.91
1152x864 60.00
1280x720 60.00 59.99 59.86 59.74
1024x768 60.04 60.00
960x720 60.00
928x696 60.05
896x672 60.01
1024x576 59.95 59.96 59.90 59.82
960x600 59.93 60.00
960x540 59.96 59.99 59.63 59.82
800x600 60.00 60.32 56.25
840x525 60.01 59.88
864x486 59.92 59.57
800x512 60.17
700x525 59.98
800x450 59.95 59.82
640x512 60.02
720x450 59.89
700x450 59.96 59.88
640x480 60.00 59.94
720x405 59.51 58.99
684x384 59.88 59.85
680x384 59.80 59.96
640x400 59.88 59.98
576x432 60.06
640x360 59.86 59.83 59.84 59.32
512x384 60.00
512x288 60.00 59.92
480x270 59.63 59.82
400x300 60.32 56.34
432x243 59.92 59.57
320x240 60.05
360x202 59.51 59.13
320x180 59.84 59.32
HDMI-1 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 509mm x 286mm
1920x1080 60.00*+ 50.00 59.94
1920x1080i 60.00 50.00 59.94
1600x900 60.00
1280x1024 75.02 60.02
1152x864 75.00
1280x720 60.00 50.00 59.94
1024x768 75.03 60.00
800x600 75.00 60.32
720x576 50.00
720x576i 50.00
720x480 60.00 59.94
720x480i 60.00 59.94
640x480 75.00 60.00 59.94
720x400 70.08
and xdpyinfo | grep resolution
resolution: 96x96 dots per inch
I'm experiencing something like this, as well. Happy to help debug as needed!
xdpyinfo | grep resolution
resolution: 96x96 dots per inch
xrandr
Screen 0: minimum 320 x 200, current 7680 x 2160, maximum 16384 x 16384
eDP-1 connected primary 3840x2160+0+0 (normal left inverted right x axis y axis) 344mm x 194mm
3840x2160 60.00*+ 59.98 59.97
3200x1800 59.96 59.94
2880x1620 59.96 59.97
2560x1600 59.99 59.97
2560x1440 59.99 59.99 59.96 59.95
2048x1536 60.00
1920x1440 60.00
1856x1392 60.01
1792x1344 60.01
2048x1152 59.99 59.98 59.90 59.91
1920x1200 59.88 59.95
1920x1080 60.01 59.97 59.96 59.93
1600x1200 60.00
1680x1050 59.95 59.88
1400x1050 59.98
1600x900 59.99 59.94 59.95 59.82
1280x1024 60.02
1400x900 59.96 59.88
1280x960 60.00
1440x810 60.00 59.97
1368x768 59.88 59.85
1280x800 59.99 59.97 59.81 59.91
1280x720 60.00 59.99 59.86 59.74
1024x768 60.04 60.00
960x720 60.00
928x696 60.05
896x672 60.01
1024x576 59.95 59.96 59.90 59.82
960x600 59.93 60.00
960x540 59.96 59.99 59.63 59.82
800x600 60.00 60.32 56.25
840x525 60.01 59.88
864x486 59.92 59.57
700x525 59.98
800x450 59.95 59.82
640x512 60.02
700x450 59.96 59.88
640x480 60.00 59.94
720x405 59.51 58.99
684x384 59.88 59.85
640x400 59.88 59.98
640x360 59.86 59.83 59.84 59.32
512x384 60.00
512x288 60.00 59.92
480x270 59.63 59.82
400x300 60.32 56.34
432x243 59.92 59.57
320x240 60.05
360x202 59.51 59.13
320x180 59.84 59.32
DP-1 connected 3840x2160+3840+0 (normal left inverted right x axis y axis) 597mm x 336mm
3840x2160 60.00*+ 29.98
1920x1200 59.88
1920x1080 60.00 50.00 59.94
1920x1080i 60.00 50.00 59.94
1680x1050 59.95
1600x900 60.00
1280x1024 60.02
1440x900 59.89
1280x800 59.81
1280x720 60.00 50.00 59.94
1024x768 60.00
800x600 60.32
720x576 50.00
720x480 60.00 59.94
640x480 60.00 59.94
720x400 70.08
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 disconnected (normal left inverted right x axis y axis)
I don't really have a solution for this. I can't reproduce on my end. It definitely looks like a DPI scaling issue. HiDPI support was added to betterlockscreen before I forked, and has just worked for the majority of users.
@mmirus I would expect that you would be running at a higher DPI given your resolution.
Ultimately, the issue lies in the way this is all being done. The box gets drawn on the background image during --update, but the indicator and text are being drawn in real-time by i3lock during --lock. So it seems we are getting different information in each stage. I had to do a bit of research to really understand how each part gets this information.
During --update, the output of the xrandr and xdpyinfo commands are parsed to gather resolution and DPI information. Then we use the logical_px() function to calculate DPI scaling for both the dimensions and position of the box.
During --lock, i3lock has two methods to determine DPI. First, it will check if Xft.dpi is set and attempt to use that value. If that doesn't work, then it falls back to getting the screen resolution (pixels) and physical display size (mm) to determine the DPI (I believe this is handled by XCB's xrandr extension). i3lock has its own logical_px() function (presumably ours was modeled after this one) to calculate the adjusted values.
In my testing, the best results were to not set Xft.dpi and to manually set the DPI with xrandr --dpi VAL. Since that's the most I can offer at the moment, I'll reopen the issue.
@jeffmhubbard thanks for taking the time to write such a thorough explanation! I tried changing some things based on what you said, but no luck, unfortunately.
I had Xft.dpi: 192 in my .Xresources file, and wasn't setting anything with xrandr. I removed the Xft.dpi setting and added xrandr --dpi 192 to my .xprofile and restarted X. Without the Xft.dpi setting, some programs such as Slack had super tiny fonts, and the position/size of the box on the lockscreen was not fixed, so I switched back.
This seems from my perspective to be an issue in the way the box size and size of relative components are calculated and positioned. The fact that using a DPI of 96, which is also the DPI of my display, on those larger screens fixes the problem indicates that the problem doesn't lie in the display or anything else but rather how the lockscreen scales its components according to the DPI. As I do not have access to a larger display to test this on, I cannot test and fix myself, however I hope this perspective may be of use to anyone that can.
I was considering forking betterlockscreen myself to fix community issues since it is no longer maintained, but this fork is evidently already the more popular option. With that being said, I will begin looking into things related to this issue.
Gave this another shot on a new Arch install (I was using Manjaro previously); same laptop and external display. With both Xft.dpi: 192 and xrandr --dpi 192 set, the box is much closer to the right size and location. Seems like it's slightly offset vertically relative to the text above it, but good enough!
Thanks again for your help on this.