end-4 / dots-hyprland

Modern, feature-rich and accessible desktop configuration.
https://end-4.github.io/dots-hyprland-wiki/en/
GNU General Public License v3.0
3.34k stars 218 forks source link

[Issue] Overview workspace view doesn't scale properly with set DPI and force_zero_scaling #424

Closed tcharchar closed 2 months ago

tcharchar commented 3 months ago
end-4 commented 3 months ago

maybe adjust overview scale in user config?

tcharchar commented 3 months ago

maybe adjust overview scale in user config?

Looks better, but the issue of apps not properly filling up the preview is still present.

image

alok-debnath commented 3 months ago

You can reduce the number of workspaces shown from 10 to 8, that's how I fixed mine. I currently don't have access to my laptop, will update this reply shortly.

Edit: @tcharchar add the below code inside .config/ags/user_options.js

'overview': {
     'numOfCols': 4,
},

so it looks something like this


const userConfigOptions = {
    'overview': {
        'numOfCols': 4,
    },
}

export default userConfigOptions;
tcharchar commented 3 months ago

Changing the number of columms from 10 to 8 makes it now fit without changing the scale from its base 0.18 value, but it still has the issue of not properly filling up a workspace preview. image

DiXN commented 3 months ago

What I have done in the past, is to divide the width / height by the current scale in variables.js :

export const SCREEN_WIDTH = Number(exec(`bash -c "hyprctl monitors -j | gojq '.[].width / .[].scale' | awk '{print int($1+0.5)}'"`));
export const SCREEN_HEIGHT = Number(exec(`bash -c "hyprctl monitors -j | gojq '.[].height / .[].scale' | awk '{print int($1+0.5)}'"`));

However, this approach has some flaws. This approach only works with Hyprland and does not work with multiple monitors. In order to solve this problem, I think there has to be a screen width and a screen height per monitor and the actual screen size after scaling has to be determined.

tcharchar commented 3 months ago

@DiXN This actually fixes a multitude of problems, including #417 too.

Edit: Thanks a lot by the way, this works great on my setup as I only use one monitor (my laptop's display).

DiXN commented 3 months ago

With the following snippet, I can get the screen width and screen height after scaling for each monitor.

const SCREEN_GEOMETRY = {}

range(Gdk.Display.get_default()?.get_n_monitors() || 1, 0).forEach(id => {
    const display = Gdk.Display.get_default()
    const monitor = display.get_monitor(id)
    const monitor_geometry = monitor.get_geometry()

    let monitor_obj = {}
    monitor_obj[id] = {
        width: monitor_geometry.width,
        height: monitor_geometry.height,
    }

    Object.assign(SCREEN_GEOMETRY, monitor_obj)
});

The idea would be to export SCREEN_GEOMETRY and to get the screen geometry of the monitor by indexing SCREEN_GEOMETRY with the monitor's id like so SCREEN_GEOMETRY[id].

For now, I am not sure how, for example, the overview is created per monitor, and therefore I set the screen width and height like this:

// Screen size
export const SCREEN_WIDTH = SCREEN_GEOMETRY[0].width;
export const SCREEN_HEIGHT = SCREEN_GEOMETRY[0].height;

This, of course, only works with one monitor. @end-4 would this concept help to set the size of the overview per monitor?

midn8hustlr commented 3 months ago

I don't think end-4 uses a secondary monitor, and would be difficult to fix these kinds to issues at their end. I guess at this point we all should sponsor a monitor to end-4 🤓.

clsty commented 3 months ago

I guess at this point we all should sponsor a monitor to end-4 🤓.

Considering about my economic status, I'm not able to help with that :/

But if @end-4 has a spare device which can run a VNC client, the following steps may provide a second "monitor":

Ate329 commented 3 months ago

What I have done in the past, is to divide the width / height by the current scale in variables.js :

export const SCREEN_WIDTH = Number(exec(`bash -c "hyprctl monitors -j | gojq '.[].width / .[].scale' | awk '{print int($1+0.5)}'"`));
export const SCREEN_HEIGHT = Number(exec(`bash -c "hyprctl monitors -j | gojq '.[].height / .[].scale' | awk '{print int($1+0.5)}'"`));

However, this approach has some flaws. This approach only works with Hyprland and does not work with multiple monitors. In order to solve this problem, I think there has to be a screen width and a screen height per monitor and the actual screen size after scaling has to be determined.

Thanks a lot!!! This solved my problem as well!

end-4 commented 3 months ago

Sorry guys I've been gaming xd So the issue lies in how when there's non-1 scaling, monitor size is reported as is, but window sizes are scaled. The above commit divides monitor dimensions by its scale (in a non-bash way that's more readable for me), which should solve this Test please? : )

DiXN commented 3 months ago

This unfortunately does not work as well as #436 does for me because Hyprland requires to have a clean divisor for scaling. In my case this is 1.066667 for the resolution 3440x1440. hyprctl monitors -j reports the rounded scale, which in my case is 1.07. 3440 / 1.07 = 3214.95 when it should be 3440 / 1.066667 = 3225. Because of the wrong calculation, there is now a gap on the side when the session menu is open. GDK uses the proper scale for the division. Maybe there is also a way to achieve this with hyprctl. I realize this is a special case, but it would still be nice if it could be solved.

image

On another note, I can see from the commit log of https://github.com/end-4/dots-hyprland/commit/18de9e2fea19f919dce04c1a6dafa7b49903716a that there have been multiple adjustments made, to set the size of the elements according to the individual monitor, however when testing on a setup with two monitors with different resolutions, it still seems to use the resolution of the first monitor.

end-4 commented 3 months ago

So Gdk reports the scaled monitor size? I'll see

end-4 commented 3 months ago

okay

tcharchar commented 2 months ago

I've recently done a full clean install of arch and this install script, and I can confirm scaling works out of the box now. Should've closed this sooner, my apologies!

end-4 commented 2 months ago

@DiXN since Gdk doesn't reliably report the scaled monitor size in all cases (causing #537), I made it so that by default manual division is used to get that data if you ever update, for your case, set userOptions.monitors.scaleMethod to "gdk"