DPI settings in Awesome window manager

15,816

Solution 1

An inelegant hack!

Currently, I am using a mix of

xrandr --output HDMI-1 --scale 0.8x0.8
export GDK_SCALE=2
export GDK_DPI_SCALE=0.6

And setting fonts. Mostly, it was taken from Arch Linux's section on HiDPI.

Not elegant at all ☹

A real solution…

Background

Issue 760 suggests that the current master branch of awesome does support custom DPI. And issue 1225 is my attempt at doing things properly.

Install master branch

sudo dnf uninstall awesome #  ← This might unisntall dependencies, re-install those!
sudo dnf install -y xorg-x11-server-Xephyr
cd ~/src/awesome # Or where ever the source is.
rm -r .build*

You now need to apply this patch, once that'd done resume:

make CMAKE_ARGS="-DCMAKE_INSTALL_PREFIX:PATH=/usr -DAWESOME_DOC_PATH=/usr/share/doc/awesome -DSYSCONFDIR=/etc " all package
sudo rpm --vv --install build/awesome*rpm
Xephyr :1 &
DISPLAY=:1 awesome -c /etc/xdg/awesome/rc.lua

If the above works, you should be nearly there. If not, use dnf to install awesome.

Nearly done, just some book keeping left.

You old configuration will not longer work, so you need to get the files from the xresources theme as well as the default rc.lua file. I would strongly recommend you take a backup of the old configuration, but really what could go wrong⸮

Your ~/.Xresources could look like this:

Xft.dpi:        156
Xft.antialias:  true
Xft.hinting:    true
Xft.rgba:       rgb
Xft.hintstyle:  hintslight

Make sure you disable awesome from being updated via dnf by adding exclude=awesome to /etc/dnf/dnf.conf.

Finally, log out (reboot, whatever) and log back in: you should now be ready.

Solution 2

With awesome 4.0 on Debian stretch, no patch as in the answer of Sardathrion is needed, that is to change your dpi to get a proper screen setup, you need to

1) Create the .Xresources file with your settings, that is Xft.dpi: 192 If you are wondering about the right DPI value, see this post. I used the next value that was a multiple of 96.

For more interesting settings, check out the informative Arch wiki entry

2) I needed to include the settings from .Xresources by adding the following line to the file .xinitrc xrdb -merge ~/.Xresources

Solution 3

On my Laptop with 3200x1800px I can set the scaling to 0.5 which displays everything correctly with:

xrandr --output $(xrandr|head -n2|tail -n1|cut -d\  -f 1) --scale 0.5x0.5

But the drawback is, that this renders the text really blurry

A solution with a sharper display is setting the resolution of the screen to half size with

xrandr -s 1600x900

This works quite well for some applications, for example Firefox looks perfect, but for example chrome has a big problem with that solution and displays all gui-menues in a really tiny font. A workaround for this I found by starting chromium on the console with

chromium-browser --force-device-scale-factor=1.0

So it seems you have to adapt many applications by hand this way.

Share:
15,816

Related videos on Youtube

Sardathrion - against SE abuse
Author by

Sardathrion - against SE abuse

I am deeply saddened and worried by the abusing behaviour of stack exchange staff with regards to its users and have stopped all activities in this network. I urge you to do educate yourselves before it is too late. The final words… Firing mods and forced relicensing: is Stack Exchange still interested in cooperating with the community? Time line of events Sign the open letter, if you wish… I did. Nescire autem quid ante quam natus sis acciderit, id est semper esse puerum. Quid enim est aetas hominis, nisi ea memoria rerum veterum cum superiorum aetate contexitur? -- Cicero, Marcus Tullius (106-43BC)

Updated on September 18, 2022

Comments

  • Sardathrion - against SE abuse
    Sardathrion - against SE abuse almost 2 years

    I have a nice new shiny 4k monitor. I can increase the font size for most applications (including awesome) however, there are a few issues:

    1. The wibar vicious widgets show a tiny font, not the one defined in theme.lia.
    2. Any Gnome applications still show the old (aka tiny) font size.

    I suspect that setting the font size everywhere will lead me going insane. Is there a DPI setting within Awesome I can use?

    If not, is there some xrandr magic I can do?

    • Jakob Lenfers
      Jakob Lenfers over 7 years
      AFAIK xrandr can only do some scaling, but then you wouldn't need the 4k monitor. But you could keep it in mind in case you want to connect a lower dpi screen as well.
    • Sardathrion - against SE abuse
      Sardathrion - against SE abuse over 7 years
      @JakobLenfers Login in using Gnome does some scaling so there is the ability in there to do it. How it does it, that's the question.
    • Sardathrion - against SE abuse
      Sardathrion - against SE abuse over 7 years
      @JakobLenfers That's currently the best I have…
  • select
    select over 4 years
    Thanks for this great answer. Could you please tell me where the magic number 96 comes from?
  • SdSaati
    SdSaati about 4 years
    Worked for me too.
  • young_souvlaki
    young_souvlaki over 2 years
    If y is omitted from scale, the x is used for both, simplifying the first line of you hack to: xrandr --output HDMI-1 --scale 0.8.