1
0
mirror of https://github.com/frebib/dotfiles.git synced 2024-06-14 12:57:23 +00:00
dotfiles/scripts/dpi
Joe Groocock 69787bd90f
dpi: set cursor size with xsettings
Signed-off-by: Joe Groocock <me@frebib.net>
2021-01-30 11:48:39 +00:00

37 lines
837 B
Bash
Executable File

#!/bin/sh
set -e
# Based on https://github.com/vincentbernat/awesome-configuration/blob/master/bin/xsettingsd-setup
dpi=$1
if [ -z "$1" ]; then
>&2 printf "Usage\n\t%s: <dpi>" "$(basename "$0")"
exit 1
fi
CONF_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/xsettingsd"
mkdir -p "$CONF_DIR"
cursor=$(echo $dpi/6 | bc | cut -d. -f1)
# Build xsettingsd.local
{
cat $CONF_DIR/xsettingsd.conf 2>/dev/null || true
echo Xcursor/size $cursor
echo Gtk/CursorThemeSize $cursor
echo Xft/DPI $(( dpi*1024 ))
echo Gdk/WindowScalingFactor $(( dpi/96 ))
echo Gdk/UnscaledDPI $(( dpi*1024/(dpi/96) ))
} > $CONF_DIR/xsettingsd.local
{
echo Xft.dpi: $dpi
echo Xcursor.size: $cursor
} | xrdb -merge
xrandr --dpi $dpi
systemctl --user reload-or-restart xsettingsd
systemctl --user --no-block reload i3 polybar@i3bar