Skip to main content

DisplayCtl - Display Configuration Manager for GNOME

A Python script that allows you to save and load monitor configurations on GNOME desktop environments using the D-Bus interface.

Features

  • Save current monitor configuration with a custom name
  • Load and apply previously saved configurations
  • List all saved configurations
  • Display current monitor setup
  • Delete saved configurations
  • Uses GNOME's native D-Bus interface (org.gnome.Mutter.DisplayConfig)

Requirements

  • GNOME desktop environment (GNOME Shell)
  • Python 3.8+
  • python3-dbus package (automatically handled by uvx/pip)

Installation & Usage

Option 1: Using uvx (Recommended)

The easiest way to use DisplayCtl is with uvx, which handles all dependencies automatically:

# Run directly with uvx (no installation needed!)
uvx displayctl current
uvx displayctl save work
uvx displayctl load work
uvx displayctl list

# Or install for repeated use
uvx install displayctl
displayctl current

Option 2: Using pip

pip install displayctl
displayctl current

Option 3: From source

# Clone/download the repository
git clone <repository-url>
cd displayctl

# Install dependencies
sudo apt install python3-dbus  # or equivalent for your distro

# Run directly
python3 -m displayctl current
# or
./displayctl.py current

Usage Examples

Save Current Configuration

displayctl save work
displayctl save home
displayctl save presentation

Load a Configuration

displayctl load work
displayctl load home

List All Saved Configurations

displayctl list

Show Current Monitor Setup

displayctl current

Delete a Configuration

displayctl delete old-config

Configuration Storage

Configurations are stored as JSON files in ~/.config/displayctl/. Each configuration contains:

  • Monitor information (connectors, available modes)
  • Logical monitor layout (position, scale, rotation)
  • Primary monitor designation
  • Display properties

Example Output

## Example Output

```bash
$ displayctl current
Current monitor configuration:
Serial: 123456

Available monitors:
  DP-1:
    Available modes: 15
      2560x1440@59.9Hz
      1920x1080@60.0Hz
      1680x1050@59.9Hz
      ... and 12 more

Active logical monitors:
  Logical monitor 1: 0,0 scale 1.0 (primary)
    - DP-1 (mode: 2560x1440@59.951171875)

$ displayctl list
Saved configurations:
  work: 2 monitor(s)
    Logical monitor 1: 0,0, scale 1.0 (primary)
      - DP-1 (mode: 2560x1440@59.951171875)
    Logical monitor 2: 2560,0, scale 1.0
      - HDMI-1 (mode: 1920x1080@60.0)
  home: 1 monitor(s)
    Logical monitor 1: 0,0, scale 1.25 (primary)
      - eDP-1 (mode: 1920x1080@60.049)

Configuration Storage

Configurations are stored as JSON files in ~/.config/displayctl/. Each configuration contains:


## How It Works

The script uses GNOME's D-Bus interface to:

1. **Get Current State**: Queries `org.gnome.Mutter.DisplayConfig.GetCurrentState()` to retrieve:
   - Available monitors and their supported modes
   - Current logical monitor configuration
   - Display properties

2. **Apply Configuration**: Uses `org.gnome.Mutter.DisplayConfig.ApplyMonitorsConfig()` to:
   - Set monitor positions and scales
   - Configure display modes
   - Designate primary monitor

## Troubleshooting

### "No such interface" error
This usually means you're not running GNOME Shell or the display server doesn't support the interface.

### "Permission denied" error
Make sure you're running the script as your regular user (not root) and that you have an active GNOME session.

### Configuration doesn't apply
Some monitor configurations might not be valid (e.g., unsupported resolution/refresh rate combinations). The script will try to apply the configuration but may fall back if it's not supported.

## Limitations

- Only works with GNOME desktop environment
- Requires an active GNOME session
- Some exotic monitor configurations might not be supported
- The D-Bus interface may change between GNOME versions

## License

This script is provided as-is for educational and practical use.

Download files

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

Source Distribution

displayctl-1.2.2.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

displayctl-1.2.2-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file displayctl-1.2.2.tar.gz.

File metadata

  • Download URL: displayctl-1.2.2.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for displayctl-1.2.2.tar.gz
Algorithm Hash digest
SHA256 36782dfb3356526e89195cc11c58822b32e60f1139befde1f779ebbf71b3330c
MD5 e9bb9386d70f5bbfb1021c35d7025569
BLAKE2b-256 1e4661597e475f0858857069492f555871c5f6b6fbcab0873c6ec063912466a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for displayctl-1.2.2.tar.gz:

Publisher: release.yml on sorenisanerd/displayctl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file displayctl-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: displayctl-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for displayctl-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e97c0479c261f8cda2f898ade974a79d17e4e0ba7e1529f73f17524588895a4e
MD5 81762b744cf3c860dea4f62d2187cb3a
BLAKE2b-256 75f3356ea8cdcb647a186577afe431a52db30103cd7ae6cf626260b8e4977cfe

See more details on using hashes here.

Provenance

The following attestation bundles were made for displayctl-1.2.2-py3-none-any.whl:

Publisher: release.yml on sorenisanerd/displayctl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.2.2 This release

2 files

1.2.0

2 files

1.0.1

2 files

1.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page