Skip to content

Instantly share code, notes, and snippets.

@gionn
Created May 30, 2020 15:29
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 gionn/2d4cf853bf6889a8674dce5628d89b72 to your computer and use it in GitHub Desktop.
Save gionn/2d4cf853bf6889a8674dce5628d89b72 to your computer and use it in GitHub Desktop.
i3 automatic HiDPI on login when external monitor is detected
if [[ $GDMSESSION == 'i3' ]]; then
# detect if external hidpi monitor is connected
if xrandr | grep 'DP1 connected 3840' > /dev/null; then
# https://wiki.archlinux.org/index.php/HiDPI
export GDK_SCALE=2
export GDK_DPI_SCALE=0.5
xrdb -merge ~/.Xresources.hidpi
# disable internal laptop monitor
xrandr --output eDP1 --off
fi
fi
Xft.dpi: 192
! These might also be useful depending on your monitor and personal preference:
Xft.autohint: 0
Xft.lcdfilter: lcddefault
Xft.hintstyle: hintfull
Xft.hinting: 1
Xft.antialias: 1
Xft.rgba: rgb
@pierreplr1
Copy link

Hi Gionn !
I think I might use a part of your solution as an answer to my issue : adjusting dpi for i3 with no impact on xfce.
The thing is I use SLIM instead of gdm, so I imagine there is an equivalent of $GDMSESSION that I could write to make it work. Something more generic or in the contrary specific to SLIM.
Would you know about that ? Thank you !
PierreP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment