62

I have a Dell XPS 13 9343 2015 with a resolution of 3200x1800 pixels.

I am trying to use i3 windows manager on it but everything is tiny and hardly readable.

I managed to scale every applications (firefox, terminal, etc...) using .Xresources :

! Fonts {{{
Xft.antialias: true
Xft.hinting:   true
Xft.rgba:      rgb
Xft.hintstyle: hintfull
Xft.dpi:       220
! }}}

but i3 interface still does not scale...


I have understood that xrandr --dpi 220 may solve the problem, but I don't know how/where to use it.

Can somebody enlighten me on this issue ?

7 Answers 7

42

Since version 4.13 i3 reads DPI information from Xft.dpi (source). So, to set i3 to work with high DPI screens you'll probably need to modify two files.

Add this line to ~/.Xresources with your preferred value:

Xft.dpi: 120

Make sure the settings are loaded properly when X starts in your ~/.xinitrc (source):

xrdb -merge ~/.Xresources
exec i3

Note that it will affect other applications (e.g. your terminal) that read DPI settings from X resources.

1
  • 7
    On Ubuntu 18.04, I didn't need an ~/.xinitrc file to get this working.
    – aparkerlue
    Feb 22, 2019 at 2:32
31

You can run xrandr as any user running an X session. Xrandr is a command line program, so you run it in your terminal.

So you would run something like this in your user terminal

$ xrandr --dpi 220
5
  • Can you explain why it seems like all the other applications work with Xft.dpi while i3 requires xrandr to set the dpi?
    – maletor
    Sep 17, 2016 at 20:21
  • 1
    Some programs read from the Xresources file, but i3 gets it's DPI reading directly from the X server. Sep 21, 2016 at 15:31
  • 4
    It seems like this is no longer the case with 4.13. The release notes state it works with Xresources (like it should).
    – maletor
    Nov 13, 2016 at 20:43
  • 1
    @maletor Correct, 4.13 and later read Xft.dpi. »As it should« is overstating it, though, since i3 will use it for DPI in general whilst Xft is supposed to apply to fonts. Generally suits users better this way, though. :-)
    – Ingo Bürk
    Dec 28, 2016 at 17:47
  • Can't confirm what comments say: with 4.17 (on Ubuntu 18.04), running the command from an answer and restarting i3 (Meta+Shift+R) fixed DPI issues with i3 elements for me.
    – Raphael
    May 12, 2020 at 17:25
24

If you only want to change the DPI within i3, you could put the command in your i3 config file with the line:

exec xrandr --dpi 220

Depending on your distro you will find the config file in different places but often under ~/.config/i3/config

0
2

Frankly on VirtualBox, I solved my I3 issue configuring resolution by a standard ubuntu/linux environment way , because the chosen answer in here didn't work for me when using VirtualBox ('xrandr --dpi 220') - my i3 session windows was just closed. So I used the following standard sequence of commands for configuring resolution:

cvt 3840 2160 60
// Output: -> Modeline "3840x2160_60.00"  712.75  3840 4160 4576 5312  2160 2163 2168 2237 -hsync +vsync

Using part of output (after word Modeline) as a parameter of a new command

xrandr --newmode "3840x2160_60.00"  3840x2160_60.00"  712.75  3840 4160 4576 5312  2160 2163 2168 2237 -hsync +vsync
xrandr --addmode VGA-1 3840x2160_60.00

// this last command activates the created resolution

xrandr -s 3840x2160

In order to preserve the configuration between user logging sessions, one has to put of course the following commands into a .bashrc init file.

Once configured, to get rid of 1 pixel scrollbars spaces, View->Scaled mode from menu is option. I also hat to configure my UltraHd display as a main display in Windows host.

My solution is a combination of two answers from the following link: Referrence: https://askubuntu.com/questions/377937/how-to-set-a-custom-resolution

Edit: Simplified appliance containg one one-liner

eval $(cvt 2220 1250 60 |sed 's/Modeline/xrandr --newmode /g'|sed -n '1!p')

as a proper result resolution screen size aspect ratio might be afterwards reevaluated/adjusted, therefore find out the created resolution by xrand command - appended in the end of output,

1) assign the resolution to a specific display -

xrandr --addmode VGA-1 "2224x1250_60.00"

2) output the desired resolution on the display

xrandr --output VGA-1 --mode "2224x1250_60.00"

3
  • This should probably be a comment, not an answer.
    – user56041
    Oct 3, 2018 at 23:12
  • good point, will put it as a comment, will delete this one, although not completely sure, because this approach didn't work for me, if somebody like me comes, he might not read my comment, anyway I let it up to you to decide, and putting a comment to an answer like: "Your approach didn't work my works, ('therefore your is wrong')" is harder to gasp for me, last edit, furthermore I realize I dont have comment privilege yet, ouch
    – FantomX1
    Oct 3, 2018 at 23:38
  • 1
    If “the chosen answer in here didn’t work for me when using VirtualBox” was the only thing you had to say, then a comment would be the right place for it.  But, if you know of an answer that works for you (when using VirtualBox), where the accepted answer (here) doesn’t work, then that should be posted as an answer.  But don’t post just a link; copy the answer here.  (1: the other answer might be deleted,  and 2: we don’t know which of the answers to the other question is the one that helped you.)  Identify the original author by (user)name, and keep the link. Oct 4, 2018 at 0:50
1

Create the ~/.Xresources file with this content:

Xft.dpi: 96

Replace 96 with the DPI you'd like to set.

1

I had the top answer working for years, something changed in my most recent update on debian testing.

To get scaling for the i3 bar and other things within i3 itself: in ~/.config/i3/config I appended

exec xrandr --dpi 192

For my application windows: in ~/.profile I added

export GDK_SCALE=2
1
  • GDK_SCALE is the secret sauce I was missing. Thank you so much. Jun 26, 2021 at 15:39
0

Since the edit in my question go removed (not sure why), here is how I fixed it :

I solved it by simply putting :

xrandr --dpi 220
exec i3

In my .xinitrc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.