dotfiles/suckless/config/autorandr/postswitch

23 lines
424 B
Plaintext
Raw Normal View History

#!/bin/sh
2020-09-19 15:33:13 +00:00
# set system dpi to the minimal dpi among all connected monitors
xrandr | awk '
BEGIN {
MIN_DPI=99999999
}
$2 == "connected" {
if (match($0, / ([0-9]+)x([0-9]+)\+([0-9]+)\+([0-9]+) /, m1) &&
match($0, / ([0-9]+)mm x ([0-9]+)mm$/, m2)) {
DPI=m1[1]*25.4/m2[1]
if (DPI < MIN_DPI) MIN_DPI=DPI
}
}
END {
printf "Xft.dpi: %i", MIN_DPI+0.5
}
' | xrdb -merge
2020-09-19 15:33:13 +00:00
nitrogen --restore