Skip to content

Instantly share code, notes, and snippets.

@maz-1
Created August 28, 2018 17:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maz-1/936308f198ac33dc5358b0f72b9034b7 to your computer and use it in GitHub Desktop.
Save maz-1/936308f198ac33dc5358b0f72b9034b7 to your computer and use it in GitHub Desktop.
#!/bin/sh
#/etc/X11/xinit/xinitrc.d/kde-gtk-hidpi.sh
#dependencies: crudini, xsettingsd
if [ "z$XDG_SESSION_DESKTOP" = "zKDE" ]
then
ScaleFactor=$(crudini --get $HOME/.config/kdeglobals KScreen ScaleFactor || echo 1)
export GDK_SCALE=$ScaleFactor
export GDK_DPI_SCALE=$(echo "scale=1;1/$ScaleFactor"|bc|sed 's/^\./0./')
smallSize=$(printf %.0f $(echo "scale=0;12*$ScaleFactor"|bc))
bigSize=$(printf %.0f $(echo "scale=0;20*$ScaleFactor"|bc))
xsettingsd_conf="/run/user/$UID/xsettingsd.conf"
xsettingsd_log="/run/user/$UID/xsettingsd.log"
echo "Gtk/IconSizes \"panel-menu=$bigSize,$bigSize:panel=$bigSize,$bigSize:gtk-menu=$smallSize,$smallSize:gtk-large-toolbar=$bigSize,$bigSize:gtk-small-toolbar=$bigSize,$bigSize:gtk-button=$smallSize,$smallSize\"" > $xsettingsd_conf
nohup xsettingsd -c $xsettingsd_conf >$xsettingsd_log 2>&1 &
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment