Skip to content

Instantly share code, notes, and snippets.

@luoxufeiyan
Last active February 22, 2020 01:54
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 luoxufeiyan/2c2a670889949f87fbfc350bb566fbd4 to your computer and use it in GitHub Desktop.
Save luoxufeiyan/2c2a670889949f87fbfc350bb566fbd4 to your computer and use it in GitHub Desktop.
Rescale between laptop built-in monitor and external hi-dpi monitor
#!/bin/bash
# Ref: https://plumz.me/archives/10034/
xrandr --query | grep ' connected' | grep 2560 > /dev/null
result=$?
if [ $result -ne 0 ]; then
# HD
# gsettings set org.gnome.nautilus.icon-view default-zoom-level standard
# gsettings set org.gnome.desktop.interface cursor-size 24
echo "Got"
eval dconf write /org/cinnamon/desktop/interface/scaling-factor "'uint32 1'"
eval dconf write /org/gnome/desktop/interface/scaling-factor "'uint32 1'"
eval dconf write /org/cinnamon/active-display-scale "1"
# Qt
export QT_SCREEN_SCALE_FACTORS=1
export QT_AUTO_SCREEN_SCALE_FACTOR=1
pidof fcitx | xargs kill
pidof nemo-desktop | xargs kill
nohup fcitx 1>/dev/null 2>/dev/null &
nohup nemo-desktop 1>/dev/null 2>/dev/null &
else
# WQHD
# For mint
eval dconf write /org/cinnamon/desktop/interface/scaling-factor "'uint32 2'"
eval dconf write /org/gnome/desktop/interface/scaling-factor "'uint32 2'"
eval dconf write /org/cinnamon/active-display-scale "1.5"
# Qt
export QT_SCREEN_SCALE_FACTORS=1.5
export QT_AUTO_SCREEN_SCALE_FACTOR=0
pidof fcitx | xargs kill
pidof nemo-desktop | xargs kill
nohup fcitx 1>/dev/null 2>/dev/null &
nohup nemo-desktop 1>/dev/null 2>/dev/null &
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment