Skip to main content

Extend a HIDPI screen to a normal DPI external display

Project description

xrandr-extend

image python versions image

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

python -m xrandr_extend.config

This creates a 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

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.

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:
                        3200, 1800)
  -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
  -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

Credits

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

History

0.2.0 (2019-07-15)

  • New optional option -x or --ext-scale for the scaling factor (PR #4, #5)

0.1.1 (2019-05-16)

  • Correct command xrandr_extend -> xrandr-extend

0.1.0 (2019-05-16)

  • Flicker correction
  • Use cookiecutter to generate src layout

0.0.3

  • Deploy to PyPI
  • Reorganize as a package and allow for configuration
  • Use pkg_resources to find default.cfg

0.0.2

  • Simpler defaults which uses only scaling factors
  • Parse args only inside __main__ and do not run any commands during dry run
  • Less bugs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xrandr_extend-0.2.0.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

xrandr_extend-0.2.0-py2.py3-none-any.whl (8.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file xrandr_extend-0.2.0.tar.gz.

File metadata

  • Download URL: xrandr_extend-0.2.0.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.3

File hashes

Hashes for xrandr_extend-0.2.0.tar.gz
Algorithm Hash digest
SHA256 987212b0b57073b7b4dba90b0fd54d3ddf22dba31d89397bac191f66a8443de6
MD5 fa509af5786494993c8f272118b64db4
BLAKE2b-256 9cf12927967cc2a0104a18bfe842e3bf9c58ea2eabac65364507747356465a13

See more details on using hashes here.

File details

Details for the file xrandr_extend-0.2.0-py2.py3-none-any.whl.

File metadata

  • Download URL: xrandr_extend-0.2.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.3

File hashes

Hashes for xrandr_extend-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 357c3a8b9d64c694147896cb89aa62831b315f72219fb7bf88c5a6249a7b0a9d
MD5 1e8bbc34e53689b1454d0d84e10244b1
BLAKE2b-256 a081b073516dcfb308b992bf5ef9efaa2c2d74eadc6fc87ff7b093640c1286be

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page