You are not logged in.

#1 2016-07-30 01:17:46

Dobbie03
Member
Registered: 2011-07-24
Posts: 118

Setting HiDPi scaling with Xrandr

Hi Guys

I am using GNome SHell and I have a 4k monitor and for the last 12 months or so  have been running at 2560x1440 because at full 4k resolution and the scaling set to 2 makes everything way too big.  I thought I might try to change the scale using Xrandr.
I followed the instructions at the wiki https://wiki.archlinux.org/index.php/Hi … le_numbers, in particular:

# First scale Gnome up to the minimum size which is too big.
# Usually "2" is already too big, but if "2" is still small for you, try "3", etc.
gsettings set org.gnome.desktop.interface scaling-factor 2
# Now start scaling down by setting zoom-out factor with xrandr.
# First get the output name:
xrandr | grep -v disconnected | grep connected | cut -d' ' -f1
# eDP1
#
# Use this value to specify --output further on.
# If you have two or more screens you can set their scale independently.
# Now, to zoom-out 1.2 times, run the following:
xrandr --output eDP1 --scale 1.2x1.2
# If the UI is still too big, increase the scale:
xrandr --output eDP1 --scale 1.25x1.25
# If UI becomes too small, decrease the scale factor a bit.
# Repeat until you find a value which works best for your screen and your eyes.
# Finally, you need to allow the mouse to navigate the whole screen.
# To do this you need to get the current scaled resolution:
xrandr | grep eDP1
# eDP1 connected primary 2304x1296+0+0 (normal left inverted right x axis y axis) 239mm x 134mm
#
# Now use the acquired resolution value to set correct panning:
xrandr --output eDP1 --panning 2304x1296

The 1.25 scaling is perfect.  What I need to know is how do I keep these settings?  When I reboot the desktop reverts back to 2x scaling.  I have put:

xrandr --output HDMI-1 --scale 1.25x1.25
xrandr --output HDMI-1 --panning 3840x2160

into my .xinitrc file but this didn't work.  Not sure where to go from here.

Cheers,

Offline

#2 2016-07-30 15:03:45

Awebb
Member
Registered: 2010-05-06
Posts: 5,324

Re: Setting HiDPi scaling with Xrandr

If you use GDM to load Gnome, then the .xinitrc is not being parsed. Go to our wiki page for Gnome and Ctrl-f for autostart.

Offline

#3 2016-07-30 18:22:52

Dobbie03
Member
Registered: 2011-07-24
Posts: 118

Re: Setting HiDPi scaling with Xrandr

Hi Awebb, thanks for the reply.  Excuse my ignorance but should I be adding the .xinitrc to autostart?


EDIT: I added this "ln -s ~/.xinitrc ~/.xsession", no change when logging in but I didn't need to restart Gnome Shell when executing

xrandr --output HDMI-1 --scale 1.25x1.25
xrandr --output HDMI-1 --panning 3840x2160

Last edited by Dobbie03 (2016-07-30 18:29:04)

Offline

#4 2016-07-30 18:44:30

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 4,942
Website

Re: Setting HiDPi scaling with Xrandr

Hi Dobbie, try creating an autostart file for the commands:

# ~/.config/autostart/xrandr.desktop
[Desktop Entry]
Exec=/usr/bin/xrandr --output HDMI-1 --scale 1.25x1.25 --panning 3840x2160
Terminal=false
Type=application

For system-wide use, consider an Xorg configuration file.

Offline

#5 2016-07-30 19:30:17

Dobbie03
Member
Registered: 2011-07-24
Posts: 118

Re: Setting HiDPi scaling with Xrandr

Thanks HoaS but that didn't work either sad.  In regards to the Xorg config, should I be adding the above commands to /etc/xorg.conf?

Offline

#6 2016-07-30 19:37:46

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 4,942
Website

Re: Setting HiDPi scaling with Xrandr

Dobbie03 wrote:

that didn't work either

Oh hmm

Does the new .desktop autostart file show up in gnome-tweak-tool?

Does the single-line `xrandr` command work if you run that?

In regards to the Xorg config, should I be adding the above commands to /etc/xorg.conf?

If only it were so simple...
big_smile

You will have to add the options via stanzas, as per `man xorg.conf`

This example (for undetected EDID modes) should give you an idea of the format needed:
https://wiki.archlinux.org/index.php/Xr … esolutions

Offline

#7 2016-07-30 19:49:58

Dobbie03
Member
Registered: 2011-07-24
Posts: 118

Re: Setting HiDPi scaling with Xrandr

Ok, the new .desktop file doesn't show in Tweak Tool, I deleted and tried again but it still won't show in Tweak Tool.

When I run 'xrandr' in the terminal I get:

Screen 0: minimum 320 x 200, current 4800 x 2700, maximum 16384 x 16384
DP-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 connected primary 4800x2700+0+0 (normal left inverted right x axis y axis) 621mm x 341mm panning 4800x2700+0+0
   3840x2160     30.00*+
   2560x1440     59.95  
   2048x1536     60.00  
   1920x1440     75.00    60.00  
   1856x1392     75.00    60.01  
   1792x1344     75.00    60.01  
   1920x1080     60.00    50.00    50.00    59.94  
   1920x1080i    60.00    50.00    59.94  
   1600x1200     75.00    70.00    65.00    60.00  
   1680x1050     59.88  
   1400x1050     74.76    59.98  
   1280x1024     75.02    60.02  
   1440x900      74.98    59.90  
   1280x960      60.00  
   1152x864      75.00  
   1280x720      60.00    50.00    59.94  
   1024x768      75.05    60.04    75.03    70.07    60.00  
   960x720       75.00    60.00  
   928x696       75.00    60.05  
   896x672       75.05    60.01  
   832x624       74.55  
   800x600       75.00    70.00    65.00    60.00    72.19    75.00    60.32    56.25  
   720x576       50.00  
   720x576i      50.00  
   700x525       74.76    59.98  
   720x480       60.00    59.94  
   720x480i      60.00    59.94  
   640x512       75.02    60.02  
   640x480       60.00    75.00    72.81    75.00    66.67    60.00    59.94  
   720x400       70.08  
   576x432       75.00  
   512x384       75.03    70.07    60.00  
   416x312       74.66  
   400x300       72.19    75.12    60.32    56.34  
   320x240       72.81    75.00    60.05  
DVI-D-1 disconnected (normal left inverted right x axis y axis)
DVI-I-1 disconnected (normal left inverted right x axis y axis)

I'll try to avoid the Xorg method for now if possible smile

Offline

#8 2016-07-30 20:03:10

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 4,942
Website

Re: Setting HiDPi scaling with Xrandr

Dobbie03 wrote:

the new .desktop file doesn't show in Tweak Tool, I deleted and tried again but it still won't show in Tweak Tool.

My example must be crap.

Try:

[Desktop Entry]
Exec=/usr/bin/xrandr --output HDMI-1 --scale 1.25x1.25 --panning 3840x2160
Icon=system-run
Path=
Terminal=false
Type=Application

Perhaps ~/.config/autostart is not parsed -- is $XDG_CONFIG_HOME set?

/etc/xdg/autostart could be used instead of~/.config/autostart

When I run 'xrandr' in the terminal I get:

Sorry, I was not clear enough.

Does this command actually work in your GNOME session:

/usr/bin/xrandr --output HDMI-1 --scale 1.25x1.25 --panning 3840x2160

Offline

#9 2016-07-30 20:21:47

Dobbie03
Member
Registered: 2011-07-24
Posts: 118

Re: Setting HiDPi scaling with Xrandr

Ok the new autostart entry is showing in Tweak, and yes

/usr/bin/xrandr --output HDMI-1 --scale 1.25x1.25 --panning 3840x2160

does work, however when I restart I have the desktop in the left corner with a nice big grey border around the outer right and bottom sides.  I need to run the commands again,

xrandr --output HDMI-1 --scale 1.25x1.25
xrandr --output HDMI-1 --panning 3840x2160

I then restart the shell with alt-f2 and 'r' and I am left with what the desktop looked like when I logged in, but if I run

xrandr --output eDP1 --scale 1.25x1.25

the desktop expands to fill the screen and the scaling is correct.


It's almost like I need something that will restart xrandr automatically.

Last edited by Dobbie03 (2016-07-30 20:24:28)

Offline

#10 2016-07-30 20:25:35

headkase
Member
Registered: 2011-12-06
Posts: 1,842

Re: Setting HiDPi scaling with Xrandr

You could try sleeping the command in an autostart so that other functions have a chance to load first:

sleep 10 & xrandr --output eDP1 --scale 1.25x1.2

Offline

#11 2016-07-30 20:36:51

Dobbie03
Member
Registered: 2011-07-24
Posts: 118

Re: Setting HiDPi scaling with Xrandr

headkase wrote:

You could try sleeping the command in an autostart so that other functions have a chance to load first:

sleep 10 & xrandr --output eDP1 --scale 1.25x1.2

Unfortunately no that didn't work either.

Last edited by Dobbie03 (2016-07-30 20:37:15)

Offline

#12 2016-07-30 22:34:19

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 4,942
Website

Re: Setting HiDPi scaling with Xrandr

OK, did a bit of digging and it seems that using an xorg.conf file may not be possible:
https://unix.stackexchange.com/question … -using-xra

However, following the tvtropes-style link-chase brings us to this section of the ArchWiki:
https://wiki.archlinux.org/index.php/Xr … figuration

Particularly:

Custom scripts calling xrandr can be bound to events (for example when external monitor is plugged in), see acpid for details. The #Scripts section provides you with some example scripts that might be useful for this purpose.

For GDM, startup scripts are executed from /etc/gdm -- perhaps try placing your commands there instead.

Offline

#13 2016-07-30 22:57:40

Dobbie03
Member
Registered: 2011-07-24
Posts: 118

Re: Setting HiDPi scaling with Xrandr

Head_on_a_Stick wrote:

OK, did a bit of digging and it seems that using an xorg.conf file may not be possible:
https://unix.stackexchange.com/question … -using-xra

However, following the tvtropes-style link-chase brings us to this section of the ArchWiki:
https://wiki.archlinux.org/index.php/Xr … figuration

Particularly:

Custom scripts calling xrandr can be bound to events (for example when external monitor is plugged in), see acpid for details. The #Scripts section provides you with some example scripts that might be useful for this purpose.

For GDM, startup scripts are executed from /etc/gdm -- perhaps try placing your commands there instead.


Thanks man, I'll do a bit of playing and report back. Cheers

Offline

#14 2016-07-30 23:05:07

Awebb
Member
Registered: 2010-05-06
Posts: 5,324

Re: Setting HiDPi scaling with Xrandr

While this doesn't really help, I'm mildly disturbed, that Gnome does not seem to have a simple way to autorun scripts.

Offline

#15 2016-07-30 23:05:57

Dobbie03
Member
Registered: 2011-07-24
Posts: 118

Re: Setting HiDPi scaling with Xrandr

Awebb wrote:

While this doesn't really help, I'm mildly disturbed, that Gnome does not seem to have a simple way to autorun scripts.


I'm with you.  There are a number of things that Gnome do that are frustrating to say the least.

Offline

#16 2018-02-27 06:24:55

lolkowatylol
Member
Registered: 2018-02-27
Posts: 1

Re: Setting HiDPi scaling with Xrandr

Sorry I have to dig because this topic is very easly accessible from google search

echo "/usr/bin/xrandr --output HDMI-1 --scale 1.25x1.25 --panning 3840x2160" >> ~/.xprofile && chmod +x ~/.xprofile

Unfortunately it works only for one user:
https://wiki.ubuntu.com/X/Config/Resolu … rsistently

Last edited by lolkowatylol (2018-02-27 06:25:19)

Offline

#17 2018-02-27 20:05:01

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,803
Website

Re: Setting HiDPi scaling with Xrandr

Welcome to the bbs. Please read the Code of Conduct.

I would particularly recommend reading the section on necrobumping.

Closing.

All the best,

-HG


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

Board footer

Powered by FluxBB