#!/bin/sh
#set font dpi base on horizontal screen resolution. Good dpi is about .065 * horizontal resolution, but lets stick with a few steps for now.

set_dpi() {
	sed -i -e '/^Xft.dpi:/ d' /root/.Xresources
	echo "Xft.dpi: $1" >> /root/.Xresources
	exit
}

RES="$(cat /sys/class/graphics/fb0/virtual_size | cut -d "," -f 1)"

[ "$RES" = "" ] && exit # Oops no luck

[ "$RES" -le "1920" ] && exit # Leave font dpi at default

[ "$RES" -le "2735" ] && set_dpi 132 #1920 to 2735 horizontal resolution 

[ "$RES" -le "3839" ] && set_dpi 168 #2735 to 3839 horizontal resolution

set_dpi 180 #4k screens and up






