23 lines
424 B
Bash
Executable File
23 lines
424 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# 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
|
|
|
|
nitrogen --restore
|