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

Fails when fractional scaling <> 100% #564

Open
fzaninotto opened this issue Jun 21, 2019 · 107 comments
Open

Fails when fractional scaling <> 100% #564

fzaninotto opened this issue Jun 21, 2019 · 107 comments
Assignees
Labels
Bug It's a bug Hacktoberfest Linux Linux specific issue

Comments

@fzaninotto
Copy link

Ubuntu 19.04 supports fractional scaling on Wayland and Xorg. When using a factor that is not the default (like 150%, for instance on a HiDPI display), and trying to capture a screenshot with flameshot, the screen flickers an changes resolution. and flameshot can only capture a quadrant of the screen.

@dszryan
Copy link

dszryan commented Sep 11, 2019

please fix this - affects the core functionality of the product when using a HiDPI screen

@flantel
Copy link

flantel commented Nov 29, 2019

Any update on this? Since the demise of Shutter, Flameshot is the best tool, but without fractional scaling it is no good to me.

Mart-Bogdan added a commit to Mart-Bogdan/flameshot that referenced this issue Jan 1, 2020
Fixes for issues flameshot-org#564 , flameshot-org#265 and flameshot-org#650 need to be tested.

Possibly laso works for flameshot-org#227  I don't know how to reproduce mixed DPI screen.
Mart-Bogdan added a commit to Mart-Bogdan/flameshot that referenced this issue Jan 1, 2020
Fixes for issues flameshot-org#564 , flameshot-org#265 and flameshot-org#650 need to be tested.

Possibly also works for flameshot-org#227  I don't know how to reproduce mixed DPI screen.
Mart-Bogdan added a commit to Mart-Bogdan/flameshot that referenced this issue Jan 1, 2020
Fixes for issues flameshot-org#564 , flameshot-org#265 and flameshot-org#650 need to be tested.

Possibly also works for flameshot-org#227  I don't know how to reproduce mixed DPI screen.
@Mart-Bogdan
Copy link

@fzaninotto @flantel
Hello, I tried to make a fix.
Can you please test patched version released here as downloadable built archive with x64 executable
https://github.com/Mart-Bogdan/flameshot/releases/tag/tmp-fix-scaling

@flantel
Copy link

flantel commented Jan 2, 2020

Hi,

No, unfortunately this does not work for me. The screen keeps flipping around between different resolutions. This is on Ubuntu 19,10/Gnome

@Mart-Bogdan
Copy link

@flantel you are using 200% scaling? indeed it wasn't working on 2x only on fractional, like 1.5x
New patch should work https://github.com/Mart-Bogdan/flameshot/releases/tag/tmp-fix-scaling-2
I've tested it on Gnome too.

@flantel
Copy link

flantel commented Jan 3, 2020

Hi @Mart-Bogdan I am using 150% on a Pixelbook, running ubuntu 19.10/Gnome/X

Result is the same - screen will flip between small and normal and continues to do so until I press escape.

@adampiskorski
Copy link

adampiskorski commented Feb 10, 2020

Same issue on Pop_OS! on both an Eve V (surface pro look-alike) and a Matebook X Pro, both at 150%.

@CumpsD
Copy link

CumpsD commented May 11, 2020

Same here on Pop_OS Surface Laptop 2 at 150% Impossible to take a screenshot, it just toggles constantly big/small/big/small/...

@karolbe
Copy link

karolbe commented Jun 15, 2020

@Mart-Bogdan Hi Bogdan, can you please confirm if your fix for fractional scaling was indeed incorporated into the main flameshot branch? Occasionally I get flameshot updates from OpenSUSE and it is breaking it, so clearly at least SUSE does not have that patch.

@Mart-Bogdan
Copy link

@Mart-Bogdan Hi Bogdan, can you please confirm if your fix for fractional scaling was indeed incorporated into the main flameshot branch? Occasionally I get flameshot updates from OpenSUSE and it is breaking it, so clearly at least SUSE does not have that patch.

Hello, no it wasn't. there were someone who took my changes into their fork.

Likely this form merged it https://github.com/hosiet/flameshot

But I've found that my patch don't work well with dual monitor set-up.
And I won't have time to take a look in the coming weeks.

@karolbe
Copy link

karolbe commented Jun 15, 2020

I have dual monitors (although with the same 4k resolution with fractional scaling) and it works perfectly. OK, I will just keep using your build. Thanks for your work!

@Mart-Bogdan
Copy link

Mart-Bogdan commented Jun 15, 2020 via email

@SergioBurlaka
Copy link

SergioBurlaka commented Jul 22, 2020

flameshot does not work fine at scale 125% display Ubuntu 20.04 LTS
The screen become flashing

@zhenglinli
Copy link

same at at scale 125% display Ubuntu 20.04 LTS

@yechs
Copy link

yechs commented Sep 25, 2020

Same here on Arch Linux w/ KDE on X11 while using version 0.8.1
Rolling back to version 0.6.0 seems to work for me

@bab5470
Copy link

bab5470 commented Nov 6, 2020

Ubuntu 20.04.1 LTS here with Dual HiDPI monitors set to 150% fractional scaling.

Running the very latest Flameshot release (0.8.5) when I try to take a screenshot both my monitors flicker on and off and it becomes actually difficult to break out of.

Has there been any progress addressing this issue? Is there a beta or alpha build we could try?

I have tried this: https://github.com/Mart-Bogdan/flameshot/releases/tag/tmp-fix-scaling-2 and it doesn't work for me.

@borgmanJeremy
Copy link
Contributor

borgmanJeremy commented Nov 7, 2020

I'm actively working on it but it is not an easy issue to solve.

Im at a point where I can confirm the screenshot is actually taken and sized correctly, however it displays with an X offset. I haven't quite figured out why.

@borgmanJeremy
Copy link
Contributor

borgmanJeremy commented Nov 15, 2020

Ive made some good progress on this. I can correct the offset by adding a move command here:

resize(pixmap().size());

The offset for my current test is 640px. My current set setup is 2x monitors with 1920x1080 resolution and fractional scaling of 1.5.

1920 * 2monitors / 640 = 6. I don't understand why there is this factor of 6, but the fact that its a perfect divisor makes me think I am on the right track.

Edit: Okay great I figured it out....still want to understand WHY the issue occurs, but there is scare documentation on QT fractional scaling. The offset is: resolution of primary display - resolution of primary display* (1/scaling)

Edit: It also seems to only happen when the primary screen is on the left.

Edit: 2020/11/22: Still havent uncovered root cause. My next step is creating a minimal working example to post on the QT forums.

Edit: 2020/11/23: Minimal working example of bug posted here: https://forum.qt.io/topic/121111/position-of-widget-with-fractional-scaling

@askvictor
Copy link

Some interesting findings (I'm running PopOS 22.04 on a laptop with an external monitor and screen scaling of 1.5 on both laptop and external).

I if I run env QT_SCREEN_SCALE_FACTORS="1.5" flameshot gui with both monitors active, the scaling is correct, but the whole arrangement is shifted left by some amount. If I increase or decrease the 1.5 I can change how much it's shift by. If I drop it down to 1, there is no shifting, but I get in a re-scaling loop. But changing it to env QT_SCREEN_SCALE_FACTORS="1.0001" flameshot gui works fine (I presume there's a tiny shift, but I can't detect it)

Interestingly, if I add zeros to the scale factor, the orientation of the monitors matters. On a side-by-side, I can set it to 1.0000000001 and it works fine. But on a one-above-the-other arrangement, 1.00001 no longer works and it goes into a re-scale loop.

But this doesn't work on just-laptop screen (at 1.5 scaling) - for that to work I need to run env QT_AUTO_SCREEN_SCALE_FACTOR=1 flameshot gui

@askvictor
Copy link

Actually, the number of zeros to make it work is a bit weird. I just tried three zeros on side-by-side, and it failed, but two zeroes worked.

And I've made a little script to make it work on either 1 or 2 monitors:

#!/usr/bin/env sh

if [ $(xrandr --listactivemonitors |grep 'Monitors:'|  awk '{print $2}') -eq 1 ]; then
	env QT_AUTO_SCREEN_SCALE_FACTOR=1 flameshot gui
else
	env QT_SCREEN_SCALE_FACTORS="1.001" flameshot gui
fi

@jaysonwcs
Copy link

I had the same issues with a multimonitor setup with laptop monitor scaled by 200% and external monitor by 100%. The settings env QT_AUTO_SCREEN_SCALE_FACTOR=1 flameshot gui and env QT_ENABLE_HIGHDPI_SCALING=1 flameshot gui had no effect. Instead env QT_SCREEN_SCALE_FACTORS="2" flameshot gui worked fine, regardless if the external monitor was attached or not (thanks pray #564 (comment)). These QT docs have some insights on these environment variables as well.

I tried what you did and, FINALLY, it worked! 🎉

@vladimir-ko
Copy link

vladimir-ko commented Oct 10, 2023

linux mint 150%
It works for me like this: linux mint
/usr/bin/env QT_AUTO_SCREEN_SCALE_FACTOR=1 flameshot gui

@fermino
Copy link

fermino commented Nov 13, 2023

QT_AUTO_SCREEN_SCALE_FACTOR=1 works with scaling=2, but not with scaling=1.9

@sergeolkhovik
Copy link

Ubuntu 23.10, scale 150%, QT_AUTO_SCREEN_SCALE_FACTOR doesn't work neither.

@l2pusok
Copy link

l2pusok commented Dec 20, 2023

/usr/bin/env QT_AUTO_SCREEN_SCALE_FACTOR=1 flameshot gui or /usr/bin/env QT_AUTO_SCREEN_SCALE_FACTOR=2 flameshot gui doesn't work on Debian 12 with Flameshot v12.1.0.

@l2pusok
Copy link

l2pusok commented Dec 22, 2023

I have two screens, first it's with no scaling, the seconds 130% scaling.

I managed to solve my issue by settings running flamshot with:

env QT_SCREEN_SCALE_FACTORS="1.3" flameshot gui

@damobeanrod
Copy link

I'm using Arch with KDE and Wayland with 1.25 scaling
My fix is to setup a command shortcut bound to print screen

XDG_SESSION_TYPE=x11 flameshot gui

The only side effect is I can't hit ctrl+c to take the photo... i.e. have to click copy to clip board a small annoyance really.
Perhaps others that can fix with the scale factors environment setting are running X11?

@winskil
Copy link

winskil commented Jan 8, 2024

@damobeanrod enabling X11 legacy app support here seems to work, but it's not the most elegant solution
image

@damobeanrod
Copy link

@winskil that is awesome kudos just what I was looking for good balance between security and form I hold down shift now to type in text boxes (I can hit caps if I don't feel like yelling hahah). Not Ideal but I think a good compromise compared to always which would forgo the requirement to hold a modifer but reduce security dramatically.

@sergeolkhovik
Copy link

My 2c, Ubuntu 23.10, flameshot 12.1.0-2, Lenovo X1C6 2560x1440, scaling 125%, running via keyboard shortcut + script (flatpak/xdg-desktop-portal#1070 (comment), no security message from Gnome), and have the same problem with scaling :(

@bgoewert
Copy link

bgoewert commented Feb 7, 2024

This worked using Flatpak. Using it with QT_AUTO_SCREEN_SCALE_FACTOR caused it to continuously switch the scaling.

env QT_SCREEN_SCALE_FACTORS="1.5" flatpak run org.flameshot.Flameshot

@bayazidbh
Copy link

As a note, you can set permanent env var in Flatseal. For CLI, you should be able to do it with flatpak override --env=VAR=VALUE according to the docs.

@leoelrojo
Copy link

Same issue as everyone above me.
Ubuntu 22.04 Wayland and I have the issue with any fractional settings out of 100% (and since I regularly switch between screens from one day or another, the settings vary).
I've tested all the solutions listed in this thread without success. I'm using the AppImage as I wanted to give a try to the v12 and this was my only option (apt is on v11 and the snap doesn't install).

@Delta-in-hub
Copy link

I'm using Arch with KDE and Wayland with 1.25 scaling My fix is to setup a command shortcut bound to print screen

XDG_SESSION_TYPE=x11 flameshot gui

The only side effect is I can't hit ctrl+c to take the photo... i.e. have to click copy to clip board a small annoyance really. Perhaps others that can fix with the scale factors environment setting are running X11?

Wow,It works for me. Arch + kde + wayland.

@MilesBHuff
Copy link

MilesBHuff commented Apr 3, 2024

The only side effect is I can't hit ctrl+c to take the photo... i.e. have to click copy to clip board a small annoyance really. Perhaps others that can fix with the scale factors environment setting are running X11?

@damobeanrod You can get Ctrl+C to work by changing KDE's settings to allow X11 apps to snoop on Ctrl presses from other apps. By default, Wayland restricts these, while X11 does not.

image

@MilesBHuff
Copy link

MilesBHuff commented Apr 3, 2024

QT_AUTO_SCREEN_SCALE_FACTOR=1, QT_SCREEN_SCALE_FACTORS=1.5, and XDG_SESSION_TYPE=x11 are not solving this scaling issue for me on openSUSE Tumbleweed + KDE + Wayland + native Flamshot v12.1.0.

@parker-research
Copy link

This appears to be working for me:

env XDG_SESSION_TYPE=x11 flatpak run org.flameshot.Flameshot

@MilesBHuff
Copy link

MilesBHuff commented May 16, 2024

QT_QPA_PLATFORM=wayland (may require installing a qtwayland package) "solves" the problem in the other direction (makes things too small) for native (non-Flatpak) Flameshot. The plus side of this, is at least you can finally capture any part of the screen. The downsides are that exact boundaries and full-screen captures are tricky.
To avoid having a giant cursor, you also have to pass QT_SCREEN_SCALE_FACTORS=1.5 (replace 1.5 with your own scaling factor).

@aykincakaloz
Copy link

Actually, the number of zeros to make it work is a bit weird. I just tried three zeros on side-by-side, and it failed, but two zeroes worked.

And I've made a little script to make it work on either 1 or 2 monitors:

#!/usr/bin/env sh

if [ $(xrandr --listactivemonitors |grep 'Monitors:'|  awk '{print $2}') -eq 1 ]; then
	env QT_AUTO_SCREEN_SCALE_FACTOR=1 flameshot gui
else
	env QT_SCREEN_SCALE_FACTORS="1.001" flameshot gui
fi

Thanks for this. It is a good workaround. I went with a variation of it

Ubuntu 22.4, Xorg. (wayland disabled)
Main screen is 175% scale and extended screen is 100% scale

In my case, QT_SCREEN_SCALE_FACTORS="1.75" is needed when working with the single monitor at 175% scaling (actually the exact number does not matter. 1.5, 1.1 or 2 all work, as long as not 1 or omitted)
But this did not work correctly when an extended monitor is attached as it rendered both screens on one screen and shrunk the size. So I removed the env setting for that case

Final code:

#!/usr/bin/env sh

if [ $(xrandr --listactivemonitors |grep 'Monitors:'|  awk '{print $2}') -eq 1 ]; then
        env QT_SCREEN_SCALE_FACTORS=2 flameshot gui
else
        flameshot gui
fi

@icy-comet
Copy link

Interestingly, on my laptop with 125% scaling, rather than increasing the QT_SCREEN_SCALE_FACTORS value, I had to decrease it for flameshot to work properly. This is the case with a build at this commit a1dda59108d420a26d603a40d1c7d25e4114d748.

I am using the flameshot-git AUR package with sway.

The exact command that worked for me:

env QT_SCREEN_SCALE_FACTORS="0.8" flameshot gui

@sergeolkhovik
Copy link

Hmm.. Unfortunately that didn't work for me (125% laptop scaling too).
BTW updated to Ubuntu 24.04 with flameshot version 12.1.0-2build2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug It's a bug Hacktoberfest Linux Linux specific issue
Projects
None yet
Development

No branches or pull requests