mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-06-24 18:58:33 +02:00
34 lines
1.1 KiB
Bash
Executable file
34 lines
1.1 KiB
Bash
Executable file
#!/bin/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
|
|
zoro,eDP1:) dpi=144 ;;
|
|
zoro,eDP-1:) dpi=144 ;;
|
|
zoro,eDP-1:HDMI-2:) dpi=144 ;;
|
|
zoro,eDP-1:DP-1:) dpi=144 ;;
|
|
neo,HDMI-1:HDMI-2:) dpi=96 ;;
|
|
neo,*) dpi=192 ;;
|
|
*) dpi=96 ;;
|
|
esac
|
|
|
|
# Build xsettingsd.local
|
|
{
|
|
cat ~/.config/awesome/xsettingsd
|
|
echo Xft/DPI $(( $dpi*1024 ))
|
|
echo Gdk/WindowScalingFactor $(( $dpi/96 ))
|
|
echo Gdk/UnscaledDPI $(( 96*1024 ))
|
|
} > ~/.config/awesome/xsettingsd.local
|
|
|
|
# Signal xsettingsd
|
|
pid=$(xprop -name xsettingsd _NET_WM_PID 2> /dev/null | awk '{print $NF}')
|
|
if [ x"$pid" = x ]; then
|
|
xsettingsd -c ~/.config/awesome/xsettingsd.local &
|
|
else
|
|
kill -HUP $pid
|
|
fi
|
|
|
|
# Also use xrdb for very old stuff (you know, LibreOffice)
|
|
echo Xft.dpi: $dpi | xrdb -merge
|