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 '
|
2020-11-14 17:37:58 +00:00
|
|
|
$2 == "connected" && $3 == "primary" {
|
|
|
|
if (match($0, / ([0-9]+)x([0-9]+)\+([0-9]+)\+([0-9]+) (left|right)?/, m1) &&
|
2020-10-30 17:12:53 +00:00
|
|
|
match($0, / ([0-9]+)mm x ([0-9]+)mm$/, m2)) {
|
2021-09-28 13:46:20 +00:00
|
|
|
DPI=m1[1]*25.4/m2[m1[5]?2:1]
|
|
|
|
if (DPI > 140) {
|
|
|
|
DPI=DPI*0.8
|
|
|
|
}
|
2020-11-14 17:37:58 +00:00
|
|
|
printf "Xft.dpi: %i", DPI
|
2020-10-30 17:12:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
' | xrdb -merge
|
2020-09-19 15:33:13 +00:00
|
|
|
|
|
|
|
nitrogen --restore
|