Skip to main content

This is a unifying wrapper around xrandr and swaymsg to control your monitors/outputs, mainly intended for setups where only one or two monitors are enabled at the same time.

xrandr's syntax is too verbose for direct usage and too explicit to use it in an i3/sway config file. This script tries to make things easier.

Examples

  • crandr cycles through all connected monitors.
  • crandr toggle toggles between the internal monitor and an external monitor.
  • crandr extend left turns on another monitor and positions it left of the currently enabled monitor.
  • crandr mirror turns on another monitor and mirrors the displayed content. If the monitors have different resolutions the internal monitor is scaled to match the resolution of the external monitor. If you want another monitor to be scaled you can specify the monitor which should not be scaled with --original. (Sway does not support mirroring yet, see this issue.)
  • crandr scale .8 if everything is displayed too small and you want to make things bigger.
  • crandr rotate left rotates the content of the currently enabled monitor so that the top of the content is at the left edge of the monitor.
  • crandr reset external enables the external monitor with default rotation and scaling and turns off all other monitors (the internal monitor).
  • crandr list to list all connected monitors.

Help

For more information see

  • crandr --help
  • crandr cycle --help
  • crandr toggle --help
  • crandr extend --help
  • crandr mirror --help
  • crandr scale --help
  • crandr rotate --help
  • crandr reset --help
  • crandr list --help

Files

crandr creates two files:

  • a config file ~/.config/crandr/config, when running crandr config
  • a bash completion script ~/.local/share/crandr/complete.bash, if it does not exit or is outdated. You need to source this file in your bashrc in order to activate the bash completion.

If you are unhappy with the default location of these scripts you can inject appdirs, xdgappdirs or platformdirs into the virtual environment (pipx inject crandr appdirs).

Installation

$ pipx install crandr

Dependencies

  • Python >= 3.8
  • xrandr and RandR >= version 1.3 or swaymsg

Dependencies for running the tests:

Alternatives

  • arandr (for X) and wdisplays (for wayland) are graphical user interfaces to control monitors.
  • autorandr (for X) and kanshi (for wayland) are programs which automatically enable output profiles when connecting and disconnecting monitors.

Metadata

Release files for crandr 1.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for crandr 1.6.1
File Size Uploaded
crandr-1.6.1.tar.gz 32.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for crandr 1.6.1
File Interpreter ABI Platform
crandr-1.6.1-py3-none-any.whl Python 3 none any Details

Total release size: 53.1 kB

Release files / crandr-1.6.1.tar.gz

Download URL crandr-1.6.1.tar.gz
Size 32.8 kB
Tags Source
SHA-256 checksum
How to use checksums
dd7f03020681f990219126875953f5a860036203cada079167e946ce57826221
BLAKE2b-256 checksum
How to use checksums
363dbc9260f75c71035e1ef99660cc991b11c8615a357a615d2356318c137188
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release files / crandr-1.6.1-py3-none-any.whl

Download URL crandr-1.6.1-py3-none-any.whl
Size 20.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4362c279f1f871d08901bf3ae4b6200362f5951a9308500e8e65086dffa4c55
BLAKE2b-256 checksum
How to use checksums
f4ae937e3db148c11419ac6172bd71a95466af84fde652a70d661bf0e016c73b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release history Release notifications | RSS feed

This release

1.6.1 This release

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page