2020-10-30 17:12:53 +00:00
|
|
|
#!/bin/sh
|
2020-09-19 15:33:13 +00:00
|
|
|
|
|
|
|
# set system dpi to the minimal dpi among all connected monitors
|
|
|
|
|
|
|
|
|
2020-10-30 17:12:53 +00:00
|
|
|
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
|