From 9d94a09b589358c814d00426a44fd86956347381 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Mon, 14 Nov 2016 06:10:26 -0600 Subject: [PATCH] [Linux] Add dpi setting for macbook air --- dotfiles/lib/bin/xsettingsd-setup | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/dotfiles/lib/bin/xsettingsd-setup b/dotfiles/lib/bin/xsettingsd-setup index 45622c71..86b591a8 100755 --- a/dotfiles/lib/bin/xsettingsd-setup +++ b/dotfiles/lib/bin/xsettingsd-setup @@ -1,13 +1,21 @@ #!/usr/bin/env sh -# Don't try to guess DPI. For a laptop, we don't want the same DPI as -# for an external screen. Just hardcode stuff... -case $(hostname),$(xrandr --current | \ - sed -n 's/\([^ ]*\) connected .*[0-9][0-9]*x[0-9][0-9]*+[0-9][0-9]*+[0-9][0-9]* .*/\1/p' | \ - sort | tr '\n' ':') in - # imalison-arch,DVI-D-0:HDMI-0:) dpi=144 ;; - *) dpi=${1:-144} ;; -esac +dpi="$1" + + +if [ -z $dpi ]; then + # Don't try to guess DPI. For a laptop, we don't want the same DPI as + # for an external screen. Just hardcode stuff... + case $(hostname),$(xrandr --current | \ + sed -n 's/\([^ ]*\) connected .*[0-9][0-9]*x[0-9][0-9]*+[0-9][0-9]*+[0-9][0-9]* .*/\1/p' | \ + sort | tr '\n' ':') in + # imalison-arch,DVI-D-0:HDMI-0:) dpi=144 ;; + imalison-uber-loaner,eDP1:) dpi=72 ;; + *) dpi=96 ;; + esac +fi + +echo "Setting dpi to $dpi" # Build xsettingsd.local cp ~/.xsettingsd ~/.xsettingsd.local @@ -22,4 +30,4 @@ else fi # # Also use xrdb for very old stuff (you know, LibreOffice) -# echo Xft.dpi: "$dpi" | xrdb -merge +echo Xft.dpi: "$dpi" | xrdb -merge