RepositoryPythonSESweden
ashwinvis

ashwinvis/xrandr-extend

:computer::arrow_right: Extend a HIDPI screen to a normal DPI external display

134stars
2forks
1issues
1views

xrandr-extend

image python versions No Maintenance Intended

[!note] Nowadays (as of 2026), display servers using Wayland is common and so is its fractional scaling support. This tool should continue to work as it is, but is only required for systems still using X11.

Extend a HIDPI screen to a normal DPI external display. This command line tool implements various solutions described in the HIDPI Arch Linux wiki page.

  • Free software: GNU General Public License v3

asciicast

Installation

pip install xrandr-extend --user

or alternatively use pipx:

pipx install xrandr-extend

Configuration

If the installation was made using pip, run:

python -m xrandr_extend.config

Alternatively, if you did use pipx, run:

pipx run --spec xrandr-extend python -m xrandr_extend.config

instead.

For both case, this creates the config file ~/.config/xrandr-extend.cfg which looks like this:

[provider:modesetting]
primary = eDP-1
hdmi = HDMI-1
vga = DP-1

[provider:intel]
primary = eDP1
hdmi = HDMI1
vga = DP1

[resolutions]
primary = 3200, 1800
hdmi = 1920, 1080
vga = 1920, 1200

# [scaling]
# primary = 1.0
# hdmi = 2.0
# vga = 2.0

# [rotation]
# hdmi = left
# vga = right

The first few sections have the name in the format [provider:display_driver]. Run xrandr --listproviders to find what your system has. The values in this section should be given as profile = monitor_name, as in the output of xrandr --listmonitors command. You may even remove existing sections and add more sections for your display driver.

Each line in the [resolutions] section signifies a resolution profile in the format profile = [width_in_pixels, height_in_pixels]. The profile primary should contain the resolution of your built-in display. You may edit or remove the remaining values hdmi and vga.

The [scaling] section contains the scale factors, which if uncommented, overrides the scale factor computed from the resolutions.

The [rotation] section specifies the directions to rotate the output contents similarly to xrandr --rotate.

Quick reference

usage: xrandr-extend [-h] [-p PRI_RES PRI_RES] [-e EXT_RES EXT_RES]
                     [-x EXT_SCALE] [-m] [-n] [-o] [-s] [-d]
                     profile

Extend a HIDPI screen to a normal DPI external display

positional arguments:
  profile               Use preset external resolution profiles (available:
                        ['hdmi', 'vga']).

optional arguments:
  -h, --help            show this help message and exit
  -p PRI_RES PRI_RES, --pri-res PRI_RES PRI_RES
                        Modify preset resolution of primary display (default: 1920, 1080)
  -e EXT_RES EXT_RES, --ext-res EXT_RES EXT_RES
                        Modify preset resolution of external display (default based on
                        profile)
  -x EXT_SCALE, --ext-scale EXT_SCALE
                        Sets the scale factor of external display (DPI of primary display /
                        DPI of external display), overriding scale factor estimation from
                        resolutions
  -r {normal,left,right,inverted,same}, --rotate {normal,left,right,inverted,same}
                        Rotation can be one of the above strings. This causes the output
                        contents of external display to be rotated in the specified direction.
                        For example 'right' specifies a clockwise rotation, 'normal' orients
                        it horizontally and 'same'preserves the current orientation.
  -m, --mirror          Mirror the external display
  -n, --pan             Pan the position of external display
  -o, --only            Extend and use only external display
  -s, --pos             Set the position of external display explicitly
  -d, --dry-run         Preview command without executing it

Examples
--------
# Built-in options or user-configured options are used when only the display
# profile is mentioned

$ xrandr-extend --dry-run vga
$ xrandr-extend vga
$ xrandr-extend hdmi

# Other options to extend the display

$ xrandr-extend --pan hdmi
$ xrandr-extend --only hdmi
$ xrandr-extend -e 1024 768 -n vga  # Pan with custom external resolution
$ xrandr-extend -x 2.0 hdmi         # Custom scale factor
$ xrandr-extend -r left hdmi        # Custom direction to rotate

Credits

This package was created with Cookiecutter and the ashwinvis/cookiecutter-pypackage project template.

Similar Projects

Discover other similar projects and AI models.

RepositoryPython
huggingface/transformers

🤗 Transformers: the model-definition framework for state-of-the-art machine learning models in text, vision, audio, and multimodal models, for both inference and training.

169.5k
Dec 1, 2026
RepositoryPython
sherlock-project/sherlock

Hunt down social media accounts by username across social networks

120.3k
Dec 2, 2026
RepositoryPython
bregman-arie/devops-exercises

Linux, Jenkins, AWS, SRE, Prometheus, Docker, Python, Ansible, Git, Kubernetes, Terraform, OpenStack, SQL, NoSQL, Azure, GCP, DNS, Elastic, Network, Virtualization. DevOps Interview Questions

87.1k
Dec 27, 2025
RepositoryC++
tensorflow/tensorflow

An Open Source Machine Learning Framework for Everyone

201.9k
Dec 1, 2026
RepositoryPython
home-assistant/core

:house_with_garden: Open source home automation that puts local control and privacy first.

92.6k
Nov 27, 2026
RepositoryPython
donnemartin/system-design-primer

Learn how to design large-scale systems. Prep for the system design interview. Includes Anki flashcards.

379.9k
Sep 15, 2026
RepositoryPython
vinta/awesome-python

The definitive list that answers "I want to do X in Python, which tool should I use?"

338.6k
Nov 28, 2026
RepositoryPython
practical-tutorials/project-based-learning

Curated list of project-based tutorials

290.9k
Nov 30, 2026
RepositoryPython
TheAlgorithms/Python

All Algorithms implemented in Python

226.6k
Nov 13, 2026