24 lines
582 B
Plaintext
24 lines
582 B
Plaintext
|
#!/usr/bin/env fish
|
||
|
|
||
|
set connecteds (xrandr | grep ' connected')
|
||
|
set total (count $monitors)
|
||
|
set dpis
|
||
|
set min_dpi 100000
|
||
|
|
||
|
|
||
|
# set dpi to the lowest one
|
||
|
for connected in $connecteds
|
||
|
set name (echo $connected | awk -F' ' '{print $1}')
|
||
|
set x_res (echo $connected | grep -oP '\d+x\d+' | string split 'x' | head -n 1)
|
||
|
set x_wid (echo $connected | grep -oP '\d+mm' | head -n 1 | grep -oP '\d+')
|
||
|
set dpi (math -s0 "$x_res*25.4/$x_wid")
|
||
|
if test $dpi -lt $min_dpi
|
||
|
set min_dpi $dpi
|
||
|
end
|
||
|
end
|
||
|
|
||
|
echo setting dpi to $min_dpi
|
||
|
echo Xft.dpi: $min_dpi | xrdb -merge
|
||
|
|
||
|
nitrogen --restore
|