reddit / emacs

Compile emacs to auto-adjust to dpi changes (e.g. with xsettingsd)

TheGrueWtf · 2022-09-15 15:56
I recently compiled my own emacs 29 in order to benefit from --with-native-compilation --with-json in lsp mode. I've heard the tale that emacs can auto adjust to dpi changes, if dpi is changed using xsettingsd. Unfortunately, I never got that to work. Can someone show me how to compile emacs so that it can auto adjust do dpi changes?
Patrick-Poitras · 2022-09-16 02:05
I am also interested in this, though I've never heard of the xsettingsd trick. Anyone have a link?
TheGrueWtf · 2022-09-16 07:12
It's not complicated per se. Have a look here [https://wiki.archlinux.org/title/Xsettingsd](https://wiki.archlinux.org/title/Xsettingsd) I'm regularly changing attached displays, so I used something similar to [https://github.com/vincentbernat/awesome-configuration/blob/master/bin/xsettingsd-setup](https://github.com/vincentbernat/awesome-configuration/blob/master/bin/xsettingsd-setup) to automate dpi changes. It is triggered by the hooks of autorandr. That works quite well, except for emacs (where it should work) and my terminal (urxvt). I have to restart them to apply the new dpi settings.
Thaodan · 2022-09-17 17:44
Does GDK allow to change the DPI on the fly? DPI changes on X11 are also mostly a hack, it is luck that it works at all.