Using autorandr (with examples)
- Linux
- November 5, 2023
Motivation
The autorandr
command is useful for automatically changing screen layouts. This can be particularly helpful in scenarios where you frequently switch between different display configurations, such as when connecting and disconnecting external monitors or projectors. With autorandr
, you can easily save and load different screen profiles, allowing you to quickly switch between configurations without manually adjusting the display settings each time.
1: Save the current screen layout
To save the current screen layout as a profile, use the following command:
autorandr --save profile_name
The profile_name
is the name you want to give to the saved profile. It can be any string, such as “work”, “presentation”, or “home”.
This command is useful when you have configured your displays in a specific way and want to save that configuration for future use. By saving profiles, you can switch between different screen layouts with ease.
Example output:
Profile "work" saved successfully.
2: Show the saved profiles
To display a list of the saved profiles, simply run the autorandr
command without any arguments:
autorandr
This command is useful when you want to see a list of the saved profiles in order to identify the one you want to load or set as the default.
Example output:
Available profiles:
- work
- home
- presentation
3: Load the first detected profile
To load the first detected profile (which can be useful when using autorandr
for the first time), use the following command:
autorandr --change
This command will automatically load the first detected profile and apply the associated screen layout.
Example output:
Loading profile "work"...
Screen layout applied successfully.
4: Load a specific profile
To load a specific profile, use the following command:
autorandr --load profile_name
Replace profile_name
with the name of the profile you want to load.
This command is useful when you want to switch between saved profiles based on your current needs or preferences.
Example output:
Loading profile "home"...
Screen layout applied successfully.
5: Set the default profile
To set a specific profile as the default, use the following command:
autorandr --default profile_name
Replace profile_name
with the name of the profile you want to set as the default.
The default profile will be automatically loaded when autorandr
is run without any arguments.
Example output:
Setting profile "presentation" as default...
Default profile updated successfully.
Conclusion
With the autorandr
command, you can easily save and load different screen layouts, allowing you to quickly switch between display configurations. This can be particularly helpful in scenarios where you frequently connect and disconnect external monitors or projectors. By leveraging the power of autorandr
, you can streamline your workflow and enhance your productivity when working with multiple displays.