phillipberndt / autorandr

Auto-detect the connected display hardware and load the appropriate X11 setup using xrandr
2.48k stars 122 forks source link

Transform not restored when switching from scaled to non-scaled display #217

Open polyfloyd opened 4 years ago

polyfloyd commented 4 years ago

Hi,

I'm using autorandr to switch between my laptop's builtin display with high DPI and external monitor with low DPI. To ensure that applications appear somewhat normal sized, I used --scale 1.25x1.25 when initially setting up the external monitor and then created a profile for autorandr with autorandr --save desk.

When switching back from the external monitor by unplugging it, the scaling information seems to be kept which causes my laptop's display to show my screen kind of cropped into the top left corner.

I fixed it manually by adding the transform property with identity matrix to the config like below. Perhaps the solution would involve something similar.

transform 1.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,1.000000
phillipberndt commented 4 years ago

Unfortunately, that approach would cause problems for users affected by https://github.com/phillipberndt/autorandr/issues/37. Autorandr uses --transform only when it thinks that that is necessary. Here, it seems the issue is that it doesn't detect properly that the transformation is applied..

Could you attach the configurations (attached/detached), xrandr --verbose for both desired configurations, and the --dry-run --debug outputs for switching?

polyfloyd commented 4 years ago

Output of xrander --verbose for each configuration:

Output of manually loading profiles:

Loading profile 'lid'
| Differences between the two profiles:
| [Output eDP-1] The output is disabled currently, but active in the new configuration
| [Output HDMI-2] The output is currently enabled, but inactive in the new configuration
\-
xrandr --fb 2560x1440 --output HDMI-2 --off --output eDP-1 --crtc 0 --gamma 1.0:0.909:0.909 --mode 2560x1440 --pos 0x0 --rate 60.01 --reflect normal --rotate normal --transform 1.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,1.000000
Loading profile 'home'
| Differences between the two profiles:
| [Output eDP-1] The output is currently enabled, but inactive in the new configuration
| [Output HDMI-2] The output is disabled currently, but active in the new configuration
\-
xrandr --fb 4300x1800 --output eDP-1 --off --output HDMI-2 --crtc 0 --gamma 1.0:0.909:0.909 --mode 3440x1440 --pos 0x0 --primary --rate 29.99 --reflect normal --rotate normal --transform 1.250000,0.000000,0.000000,0.000000,1.250000,0.000000,0.000000,0.000000,1.000000