Add dynamic DPI settings

Adjust DPI settings based on display resolution.
This commit is contained in:
Jens Sauer 2020-11-23 21:55:37 +01:00
parent fbf13b7ff4
commit 52b19c4d1d
4 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,7 @@
Xft.dpi: 144
Xft.autohint: 0
Xft.lcdfilter: lcddefault
Xft.hintstyle: hintfull
Xft.hinting: 1
Xft.antialias: 1
Xft.rgba: rgb

View File

@ -0,0 +1,7 @@
Xft.dpi: 96
Xft.autohint: 0
Xft.lcdfilter: lcddefault
Xft.hintstyle: hintfull
Xft.hinting: 1
Xft.antialias: 1
Xft.rgba: rgb

View File

@ -0,0 +1,7 @@
Xft.dpi: 120
Xft.autohint: 0
Xft.lcdfilter: lcddefault
Xft.hintstyle: hintfull
Xft.hinting: 1
Xft.antialias: 1
Xft.rgba: rgb

View File

@ -4,3 +4,25 @@ if [ -f ~/.profile ]; then
fi
xrdb -merge ~/.Xresources
# Load settings for HiDPI only when HiRes display is connected
#
SR=$(xrandr --query | grep ' connected' | egrep -o '[0-9]+x[0-9]+\+[0-9]+\+[0-9]+')
MAX_RES=0
for RES in $SR
do
SRX=$(echo $RES | cut -d'x' -f 1)
if [ $MAX_RES -lt $SRX ]; then
MAX_RES=$SRX
fi
done
# FullHD
if [ $MAX_RES -le 1920 ]; then
xrdb -merge ~/.Xresources.d/lowdpi
# 2k
elif [ $MAX_RES -gt 1920 || $MAX_RES -lt 2500 ]; then
xrdb -merge ~/.Xresources.d/middpi
elif [ $MAX_RES -gt 2500 ]; then
xrdb -merge ~/.Xresources.d/hidpi
fi