Skip to content

Instantly share code, notes, and snippets.

@jesus-sayar
Last active September 15, 2019 12:32
Show Gist options
  • Save jesus-sayar/4235b214c8193c9b8833ad0e7bc39952 to your computer and use it in GitHub Desktop.
Save jesus-sayar/4235b214c8193c9b8833ad0e7bc39952 to your computer and use it in GitHub Desktop.
Configure Dell XPS 13' with HiDPI and external monitor
#!/bin/sh
one_monitor () {
echo "Configure one monitor!"
# Window scaling down
gsettings set org.gnome.desktop.interface scaling-factor 2
xrandr --output eDP1 --mode 3200x1800 --primary --scale 1x1 --output HDMI1 --off
}
two_monitors () {
echo "Configure two monitors!"
# Window scaling down
gsettings set org.gnome.desktop.interface scaling-factor 1
# Configure screens layout and resolucion
xrandr --output HDMI1 --mode 1920x1080 --pos 0x0 --rotate normal --primary --output DP1 --off --output eDP1 --mode 1920x1080 --pos 1920x0 --rotate normal --output VIRTUAL1 --off
}
IN="eDP1"
EXT="HDMI1"
if (xrandr | grep "$EXT disconnected"); then
one_monitor
else
two_monitors
fi
1. Create folder: mkdir ~/opt/monitors/bin
2. Copy script in the bin folder
3. Add folder to PATH add to .bashrc this: export PATH=$PATH:~/opt/monitors/bin
4. Use the script executing "set_monitor 1" or "set_monitor 2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment