sway
sway copied to clipboard
Fractional scaling creates a small border
When running with fractional scaling I get a thin border on the right and bottom edge of the screen. Depending on how I change the scale it can apear as only a border on the bottom or on the right side. If i set it to an integer value the borders dissapear.
swaymsg -t get_version: sway version 1.0 swaymsg -t get_outputs: http://ix.io/1JNy
steps to reproduce: swaymsg output eDP-1 scale 1.75
It were hard to take a screenshot of this particular issue, so here are some dizzy photos instead: swaylock is running on these photos, but it looks the same when unlocked.
scale 2 (working as intended):
scale 1.75 (small border visible):
same problem but mine is only on the right side my scale is 1.5
I played around a bit with the computer at home as well which has the same symptoms (on a larger screen). There I have scaling 1.4 when I set that scaling it sets the following:
$ swaymsg output DP-3 scale 1.4
"rect": {
"x": 2560,
"y": 0,
"width": 2742,
"height": 1542
},
"scale": 1.3999999761581421,
"percent": 0.5171633345907205,
"current_mode": {
"width": 3840,
"height": 2160,
"refresh": 59997
},
Now if I divide 2160/1542 I get 1.4007782101 and then setting this scale instead makes the borders go away and resulting in the following output:
$ swaymsg output DP-3 scale 1.4007782101
"rect": {
"x": 2560,
"y": 0,
"width": 2741,
"height": 1542
},
"percent": 0.51707225051877004,
"scale": 1.4007781744003296,
So with a bit of manual tinkering there is a workaround.
I made a small script to get reasonably accurate scaling proportions. It returns you the scaling where dividing the screen resolution with the scale produces 4 decimals of zeroes on both height and width. It seems to produce the intended result on both a machine with 3840x2160 and a laptop with 3200x1800.
https://gist.github.com/marulkan/031c85ff8cfb19489e0570758c9da2de
I bet this is the same bug that I (probably incorrectly) filed on swaybg: https://github.com/swaywm/swaybg/issues/5
I'm also experiencing this, here's a screenshot. I'm using a fractional scale of 2.333. The optimal value for my display in terms of size seems around 2.25, but 2.333 looks significantly less blurry. I'm guessing it has something to do with the display's subpixel arrangement. Unfortunately it also results in that border.
Since I'm using a black background, I think it'd be fine if the border used the background colour. I don't really mind if windows don't exactly fill the screen.
Edit: Interesting detail, if I make a window fullscreen, it hides this border.
I believe that this issue has been fixed in #7468, as I can repro this when using the sway package on Arch Linux but not when building from master.
I still have this behavior on Sway 1.9 using the Arch (not AUR) package.
Here are my current settings, the issue occurs with scale factors of 1.25 and 1.5 as well.
Output eDP-1 'BOE 0x0BCA Unknown' (focused)
Current mode: 2256x1504 @ 59.999 Hz
Power: on
Position: 0,0
Scale factor: 1.200000
Scale filter: linear