Skip to content

Instantly share code, notes, and snippets.

@jflorian
Created March 2, 2021 12:16
Show Gist options
  • Save jflorian/38c6d67133fdf45928c7c8f9ede3430b to your computer and use it in GitHub Desktop.
Save jflorian/38c6d67133fdf45928c7c8f9ede3430b to your computer and use it in GitHub Desktop.
#!/bin/sh
set -x
displays() {
local scale=$1
echo "HDMI-1=${scale};HDMI-2=${scale};DP-1=${scale};DP-2=${scale};eDP-1=${scale};"
}
case $HOSTNAME in
# host1 has a 4k display
hos1.example.com )
kwriteconfig5 --file ~/.config/kcmfonts --group General --key forceFontDPI 192
kwriteconfig5 --file ~/.config/kdeglobals --group KScreen --key ScaleFactor 2
kwriteconfig5 --file ~/.config/kdeglobals --group KScreen --key ScreenScaleFactors $(displays 2)
kwriteconfig5 --file ~/.config/startupconfig --key kdeglobals_kscreen_screenscalefactors $(displays 2)
kwriteconfig5 --file ~/.config/startupconfig --key kcmfonts_general_forcefontdpi 192
;;
# all my other hosts have a 2k display
* )
kwriteconfig5 --file ~/.config/kcmfonts --group General --key forceFontDPI 0
kwriteconfig5 --file ~/.config/kdeglobals --group KScreen --key ScaleFactor 1
kwriteconfig5 --file ~/.config/kdeglobals --group KScreen --key ScreenScaleFactors $(displays 1)
kwriteconfig5 --file ~/.config/startupconfig --key kdeglobals_kscreen_screenscalefactors $(displays 1)
kwriteconfig5 --file ~/.config/startupconfig --key kcmfonts_general_forcefontdpi 0
;;
esac
case $HOSTNAME in
* )
kwriteconfig5 --file ~/.config/powermanagementprofilesrc --group AC --group DPMSControl --key idleTime 600
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment