Simplifying Display Management with autorandr

2 minute read

For many Linux users, managing multiple display setups can be a hassle. Whether you’re switching between your laptop and an external monitor at your workstation or connecting to a projector for a presentation, reconfiguring display settings manually can be time-consuming. Enter autorandr — a powerful tool that automates this process.

What is autorandr?

autorandr is a command-line utility that automatically detects connected displays and applies predefined configurations (profiles) based on those connections. It seamlessly integrates with the udev system, allowing it to respond to changes in display connections in real-time.

Key Features

  • Automatic Detection: Monitors when displays are connected or disconnected.
  • Profiles: Create and save multiple display configurations for different setups.
  • Command-Line Interface: Suitable for automation and scripting.
  • Desktop Environment Compatibility: Works with GNOME, KDE, XFCE, and others.

Getting Started

Installation

You can install autorandr using your package manager. Here are some commands for popular Linux distributions:

  • Arch-based systems:
1sudo pacman -S autorandr
  • Debian/Ubuntu-based systems:
1sudo apt install autorandr
  • Fedora:
1sudo dnf install autorandr

Creating Profiles

After installation, you can create profiles based on your desired display setup. Connect your monitors and run:

1autorandr --save <profile_name>

Replace <profile_name> with a descriptive name for your configuration (e.g., home, office).

Automatic Detection

Once profiles are created, autorandr will automatically apply the relevant profile whenever you connect or disconnect displays. It uses udev rules set up during installation to listen for these events.

Manual Usage

If you need to apply a profile manually, you can do so with:

1autorandr --load <profile_name>

Advanced Configuration

For users looking to customize their settings further, autorandr creates a main configuration directory that contains files for each saved profile located at ~/.config/autorandr. You can edit this file to adjust settings for individual profiles and other advanced options.

A list of all saved profiles can be output via:

1autorandr --list

Conclusion

autorandr is an essential tool for anyone who frequently switches between different display configurations on Linux. By automating the detection and application of display settings, it saves time and streamlines your workflow.