hardpixel / unite-shell

Unite is an extension that makes GNOME Shell look like Ubuntu Unity Shell.
GNU General Public License v3.0
935 stars 62 forks source link

[Bug] DPI changes and window controls not re-scaling #106

Open luispabon opened 5 years ago

luispabon commented 5 years ago

I'm running unite in Pop 19.04. This laptop has a 4k screen, and I run it at scale 2. Unite shows the window controls in the panel just fine.

The problem is when I connect a second, non hidpi monitor and the hidpi daemon compensates by changing the laptop to 1080p and scale 1:

image

Conversely, if gnome and unite load up initially at scale 1 cause I have external monitors connected, and then I disconnect them and the laptop screen goes back to 4K, the opposite happens (window controls way too small).

budzynski commented 5 years ago

+1

Also, quick mitigation for the time being: Alt + F2, type "r", and hit Enter. It will refresh the Gnome Shell and fix the buttons' scale.

jonian commented 5 years ago

Can you try in changing in https://github.com/hardpixel/unite-shell/blob/master/unite%40hardpixel.eu/modules/windowButtons.js#L27:

// From this
this._signals.connect(this.monitorManager, 'monitors-changed', 'toggleButtons')

// To this
this._signals.connect(this.monitorManager, 'monitors-changed', 'updateButtons')
budzynski commented 5 years ago

Didn't resolve the problem.

Another interesting thing (lazy render?) - if I don't hover over the buttons on the first screen, then switch to another screen, and hover over the buttons on the new screen - the hovered buttons' size is correct.

plumlis commented 4 years ago

Same here My laptop has 4K diskplay and I using it with 200% scaling. Sometimes I use it with 1080p monitor and set scaling to 100% After I changed scaling, the windows control buttons ( Max Min Close) won't auto scale to the correct size, It looks sooo big or sooo small. I have to restart gnome-shell to slove this. (Alt+F2 and type R)

plumlis commented 3 years ago

Is there a workaround for this issue? I'm now on wayland, and There is no way to restart gnome-shell.

plumlis commented 2 years ago

Any news about this issue?

jonian commented 2 years ago

@plumlis The issue is tagged as help-wanted because I don't have a hidpi screen to work on this.

plumlis commented 2 years ago

@jonian Thanks for your reply.

Actually you don't really need a HiDPI to test about this issue, You can do these step like this:

gnome-shell-screenshot-50um6h

The Main issue seems is window controls buttons don't change with display Scaling

By the way, I'm glad to help you with my HiDPI Display.

ilya-m32 commented 1 year ago

Hey, recently learned about this extension - great stuff, really enjoy it! Many thanks to the authors.

In Ubuntu 23.04, Gnome Shell=44.0 and unite-shell=71 the issue seems to remain unresolved. I also confirm that steps to reproduce are the same as in the previous comment: https://github.com/hardpixel/unite-shell/issues/106#issuecomment-1016452385

I made few quick experiments with the code and seems that buttons once rendered are preserved in the same scale factor, even if the Btn element is re-created due to layout change.

Then, I decided to try St.Icon widget instead of using background-image: url('some_file.svg') for window controls and it seems to be working fine - it perfectly adapts for different scaling factors like 1x / 2x / 3x.

I made a small demo theme which works this way and adapts to different scale factors. Here's the commit (see screenshots for 2x/1x scaling factor).

Screenshot from 2023-05-11 00-05-46 Screenshot from 2023-05-11 00-05-17

My guess is that there might be a gnome-shell bug related to re-scaling background-image svg once rendered - no proofs, though, I also don't know much about gnome-shell architecture.

I have some ideas about validating this hypothesis and possible workaround, will try it out a bit later.

JoveYu commented 1 year ago

any update?

ilya-m32 commented 1 year ago

I played with the issue a little bit and it seems to be a gnome bug apparently; none of the ways I tried to force redraw worked.

Due to limited time, I just switched to my ad-hoc theme using St.Icon default icons which works fine and you can find it in my fork. Probably worth reporting this bug to gnome folks.

If anyone wants this, I can create a PR to the upstream with this theme.

ilya-m32 commented 1 year ago

I reported the issue to the Gnome team, let's see how it goes.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6824

ilya-m32 commented 11 months ago

No updates from gnome shell team but I found a workaround: https://github.com/hardpixel/unite-shell/pull/356 Feel free to join discussion there