dotfiles/gui/autorandr/postswitch

17 lines
386 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 '
$2 == "connected" && $3 == "primary" {
if (match($0, / ([0-9]+)x([0-9]+)\+([0-9]+)\+([0-9]+) (left|right)?/, m1) &&
match($0, / ([0-9]+)mm x ([0-9]+)mm$/, m2)) {
2021-09-27 06:29:05 +00:00
DPI=m1[1]*25.4/m2[m1[5]?2:1]*0.8
printf "Xft.dpi: %i", DPI
}
}
' | xrdb -merge
2020-09-19 15:33:13 +00:00
nitrogen --restore