alex-courtis / xlayoutdisplay

Detects and arranges linux display outputs, using XRandR for detection and xrandr for arrangement.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature: support xsettingsd

infabo opened this issue · comments

https://github.com/derat/xsettingsd is a lightweight replacement for gnome-settings-daemon.
I use it together with i3wm.

It would be a nice if xlayoutdisplay would update Xft/DPI setting. see https://github.com/derat/xsettingsd/wiki/Settings

Settings-file is possibly always located at $HOME/.xsettingsd.

killall -HUP xsettingsd to reload the xsettingsd config.

Today I Learned about xsettings. Under dwm, apps like chrome, inkscape, audacity, pavucontrol actively change their size when Xft/DPI is updated. Terminals alacritty, st and xterm do not read xsettingsd however that is to be expected.

An option could be added, something like:

-x [ --xsettingsd ]          update xsettingsd
...
echo "Xft.dpi: 156" | xrdb -merge

echo "Xft/DPI 159744" > ~/.xsettingsd

killall -HUP xsettingsd

Problem:
The Xft/DPI setting in ~/.xsettingsd needs to be created or updated. Appending a new value to the file results in an error when there is already a value. Clobbering the whole file would result in other settings being lost.

Possible Solutions:

  1. Read ~/.xsettingsd if it's present, update or create Xft/DPI, write the file.
  2. Use a text processor like sed or awk to update ~/.xsettingsd

xsettingsd seems a little immature and early in its lifecycle. An nicer API to update values would be useful, it may be added later.

However, I will happily accept a PR to add xsettingsd support.

Extension:
No option, instead detect xsettingsd running (similar to xorgRunning) and perform the update.