Last active
May 16, 2020 08:59
-
-
Save AGlass0fMilk/16672f82439a6bc601d80632b99f6179 to your computer and use it in GitHub Desktop.
Mixed DPI on Ubuntu - Dell XPS 15 9570 and TB16 dock with 4K internal/1080p external displays
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# put the following in a udev rule file | |
# for example /etc/udev/rules.d/99-tb16-dock.rule | |
ACTION=="add", SUBSYSTEM=="thunderbolt", ATTR{device_name}=="Dell Thunderbolt Dock", RUN+="/bin/systemctl --no-block start configure-tb16-dock.service" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Configuration changes when connecting Dell TB16 Dock | |
[Service] | |
Type=simple | |
User=<YOUR_USER_NAME> | |
Environment="DISPLAY=:0" | |
ExecStartPre=/bin/sleep 8 | |
ExecStart=/home/gdbeckstein/bin/configure_dock.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Run when Dell Thunderbolt Dock is attached and configures displays accordingly | |
# To have this run automatically when your dock is plugged in | |
# create a udev rule in /etc/udev/rules.d named 99-tb16-dock.rules | |
# Also place the other .service file in this gist in /etc/systemd/system | |
# You may be able to just run this script from the udev rule | |
# but I made it a systemd service | |
# Set up frame buffer (add up horizontal since my displays are side by side) | |
xrandr --fb 7680x2160 && | |
# Set up laptop monitor | |
xrandr --output eDP-1 --mode 3840x2160 --rate 60 --primary && | |
# Set up external display(s) | |
# My configuration only has a 1080p display to the right of my laptop | |
xrandr --output DP-1-1 --mode 1920x1080 --scale-from 3840x2160 --panning 3840x2160+3840+0 --right-of eDP-1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment