Ventto / mons

POSIX Shell script to quickly manage monitors on X
MIT License
632 stars 39 forks source link

Bug: mons -s works only one time #27

Closed cserb closed 6 years ago

cserb commented 6 years ago

So I started to have the following problem:

I start Xorg and type in mons -s. It would switch as expected (though leaving the primary monitor turned on) to the second monitor. Now type mons -o (works) and I type mons -s again. Second time it wouldn't work and I need to restart Xorg to make it work again.

If I use xrandr it works all the time and it also properly turns off the primary monitor:

xrandr --output eDP-1 --off --output HDMI-1 --auto
xrandr --output eDP-1 --auto --output HDMI-1 --off

What exactly is the xrandr command when mons -s is executed?

Ventto commented 6 years ago

Hi @cserb, Thanks for your feedback.

It does (let's say A is the primary monitor and B the second one):

$ mons -s
xrandr --output A --off
xrandr --output B --auto --dpi "$dpi"

$ mons -o
xrandr --output B --off
xrandr --output A --auto --dpi "$dpi"

Could you please give me some information about your environment ?

What is the result of the following command:

$ xdpyinfo | grep dots
cserb commented 6 years ago

xrandr output:

Screen 0: minimum 320 x 200, current 2560 x 1440, maximum 8192 x 8192
eDP-1 connected primary 2560x1440+0+0 (normal left inverted right x axis y axis) 309mm x 174mm
   2560x1440     60.01*+  59.99    59.99    59.96    59.95  
   1920x1440     60.00  
   1856x1392     60.01  
   1792x1344     60.01  
   2048x1152     59.99    59.98    59.90    59.91  
   1920x1200     59.88    59.95  
   1920x1080     60.01    59.97    59.96    59.93  
   1600x1200     60.00  
   1680x1050     59.95    59.88  
   1400x1050     59.98  
   1600x900      59.99    59.94    59.95    59.82  
   1280x1024     60.02  
   1400x900      59.96    59.88  
   1280x960      60.00  
   1440x810      60.00    59.97  
   1368x768      59.88    59.85  
   1280x800      59.99    59.97    59.81    59.91  
   1280x720      60.00    59.99    59.86    59.74  
   1024x768      60.04    60.00  
   960x720       60.00  
   928x696       60.05  
   896x672       60.01  
   1024x576      59.95    59.96    59.90    59.82  
   960x600       59.93    60.00  
   960x540       59.96    59.99    59.63    59.82  
   800x600       60.00    60.32    56.25  
   840x525       60.01    59.88  
   864x486       59.92    59.57  
   700x525       59.98  
   800x450       59.95    59.82  
   640x512       60.02  
   700x450       59.96    59.88  
   640x480       60.00    59.94  
   720x405       59.51    58.99  
   684x384       59.88    59.85  
   640x400       59.88    59.98  
   640x360       59.86    59.83    59.84    59.32  
   512x384       60.00  
   512x288       60.00    59.92  
   480x270       59.63    59.82  
   400x300       60.32    56.34  
   432x243       59.92    59.57  
   320x240       60.05  
   360x202       59.51    59.13  
   320x180       59.84    59.32  
DP-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 connected (normal left inverted right x axis y axis)
   3840x2160     30.00    25.00    24.00    29.97    23.98  
   2560x1440     59.95  
   1920x1080     60.00    50.00    59.94    30.00    24.00    29.97    23.98  
   1680x1050     59.88  
   1600x900      60.00  
   1280x1024     75.02    60.02  
   1440x900      59.90  
   1280x800      59.91  
   1152x864      75.00  
   1280x720      60.00    50.00    59.94  
   1024x768      75.03    70.07    60.00  
   832x624       74.55  
   800x600       72.19    75.00    60.32    56.25  
   720x576       50.00  
   720x480       60.00    59.94  
   640x480       75.00    72.81    66.67    60.00    59.94  
   720x400       70.08  
DP-2 disconnected (normal left inverted right x axis y axis)
HDMI-2 disconnected (normal left inverted right x axis y axis)
$ xdpyinfo | grep dots
resolution:    162x162 dots per inch
Ventto commented 6 years ago

mons sets the dpi at 96 by default. Try again with the --dpi DPI option.

$ mons -o --dpi 162
$ mons -s --dpi 162

The issue could come from there.

cserb commented 6 years ago

Works now... so this seems to have been the issue.

There is one more minor annoyance , that the original screen stays on showing the upper left corner of the bigger screen. Again this doesn't happen if I use xrandr directly.

Ventto commented 6 years ago

Okay, I will remove the dpi setting of 96 by default while keeping the --dpi VALUE option