Enabling and disabling certain monitors with a keyboard shortcut

I’ve been looking to see if there is a way to enable/ disable certain monitors with a keyboard short cut, I currently have 3 monitors, but one of them I only use when I get in bed and I would like the other two to be disabled. I know that there is something similar to this is xfce when you hit super + p, but I was wondering if there was something else like it on other desktop environments. I am trying to switch from windows to linux and it would be really nice to be able to just use a keyboard shortcut to change which monitors I have enabled without having to go into the display setting every time.

Welcome to EOS!

I suggest to use autorandr to save your two monitor configs.

In a nutshell you can save once each of your display configurations. you can do that by using system settings/display and select your configuration (or in terminal via xrandr) and save it first:

autorandr --save work

To load profile work simply type:

autorandr --load work

Where work is a random name you choose for one of your setup. Then do the same for your second setup and save it as bedtime profile for example, you choose whatever name.

Then you could assign a keyboard shortcut for each profile to a custom terminal command. This can be done in system settings custom keyboard shortcuts…

You can also pull up a terminal and switch between setups. Let’s say you have a profile work for day and profile bedtime saved for evening, then you just type autorandr --load work or bedtimeas shown above with corresponding profile.

1 Like

welcome to the forum @ZXSwire3 :partying_face: :balloon: :tada: :enos_flag: :enos:


Thank you so much, this seems to be exactly what I was looking for! After some playing around with it though I am still having a bit of an issue with it, I can go from my “bed” setup to my “desk” setup with no issue, but when I try going from the “desk” setup to the “bed” one I get an error and it doesn’t change setups. I did find a sort of work around it failing, but I wanted to know if there was a better way of doing it so that I don’t have to use the work around. The work around is that I mark the “bed” monitor as active so that all 3 monitors are active and then run

autorandr --load bed

which then actually loads the setup properly. Am I doing something wrong with the way that I configured the setups or do I just have to enable all 3 and then change setups and if it is that is there a way to do that with just a terminal command?

Here’s the error that I get when trying to switch from “desk” to “bed”

$ autorandr bed
xrandr: specified screen 1920x1080 not large enough for output DP-2 (2560x1440+0+0)
xrandr: Configure crtc 0 failed
xrandr: specified screen 1920x1080 not large enough for output DP-2 (2560x1440+0+0)
xrandr: Configure crtc 0 failed
Failed to apply profile ‘bed’ (line 857):
Command failed: xrandr --fb 1920x1080 --query --output HDMI-0 --off (line 857)

1 Like
autorandr --load <profile> --force

you could try that, sometimes it doesn’t want to load twice the same profile in the same login session. Don’t ask me why.

Unfortunately that did not work, however, I did find a different solution. I just figured out how to enable my “bed” display from the terminal and then bound both commands to a single keyboard shortcut. Luckily it wasn’t that hard to figure out how to enable the monitor through the terminal. I just used


to figure out how what monitor options that I had to enable and then used the command

xrandr --output DVI-D-0 --auto

I then just put it all together and ended up with

sh -c “xrandr --output DVI-D-0 --auto; autorandr --load bed”

Thank you for all the help, I don’t think I would have been able to get started if you didn’t help to begin with :slight_smile:


autorandr seems like it just might work for my setup on bspwm :wink: Thanks for the suggestion.

I think you only need to work with xrandr, here’s how my keyboards shortcut look like:

Super+P disables all but the middle monitor, Super+O enables all monitors back. You can manage as many monitor as you want, by expanding on this example.

You can also create shortcuts to disable only a single monitor and leave all the other ones enabled.

All you need to do is xrandr --listmonitors to see how they are named. To see only the active ones: xrandr --listactivemonitors.

The way I’ve configured the shortcuts, they also rearrange the monitors to the desired order if they somehow get scrambled when plugging them out and back in again.

Btw, the xset dpms force off command puts all monitors to sleep until mouse or keyboard action is detected.

1 Like

Of course things can be done manually with xrandr, but I never remember the commands and it takes me longer to look them up and type all these words. The best thing with autorandr is that I have a profile at home and one at work. I just unplug my laptop at one place and plug it at the other and it recognizes my profile. No need for keyboard shortcuts or others.

I commonly arrange my screens and resolution manually using arandr then save/load profiles via autorandr. Note you could also use arandr to manually switch on/off displays, arrange them and set resolution for each and save the xrandr profile in a file that you can load with a script.

Just add the autorandr --change to bspwm or i3 config and the command in front necessary to run your programs. For example on i3

exec_always autorandr --change

Or type autorandr --change in terminal. More convenient to me, especially on wm.

Many different possibilities, whatever works for you guys :grin: but xrandr is the main program that does the work, others are just tools to make life easy.

Yeah, I know what you’re saying, I was also using some xrandr helper but when I switched from 2 to 3 monitors it kind of choked screing up their order and turning only the leftmost monitor on, so I was forced to dig into xrandr and do things manually.