Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

There are several displays connected to a PC, say A B C. How can I trigger a display reconfiguration based on a count down. I'd like display A to be active from 6 am to 1 pm, display B from 1pm to 5 pm, and display C from 5 pm to 6 am. The desktop should always be routed only to the active display.

share|improve this question
    
All I can think of is using Task Scheduler.. but the actual command to change the display is beyond me. I read around and read that you can probably make some VBScript that does switch screen... but I haven't got the actual code. Good luck. –  Darius May 27 '13 at 11:23
    
Adding as comment as this is a partial answer. Check this answer to change display from command line: stackoverflow.com/questions/12329103/… - basically trigger displayswitch.exe /external or something on your task scheduler. The issue is I'm not sure how this would work with a 3-monitor setting, and displayswitch.exe is like a command line for Windows Key + P. –  Darius May 27 '13 at 11:32
add comment

2 Answers

up vote 1 down vote accepted

Since your question is tagged as both Linux and Windows, here's a Linux solution.

You need a little script that changes the display. The easiest would be ti use xrand which should either be installed already or is in your distribution's repositories. In the unlikely case that it is not installed, you can install it on Debian-based systems with

sudo apt-get install x11-xserver-utils

Once xrandr is installed, you will first need to get the names of your displays:

xrandr | grep -w connected | awk '{print $1}'
 VGA-0
 DP-0

On my laptop, that shows that I have two available displays, the laptop's (DP-0) and a VGA screen (VGA-0). To activate only the laptop's I would run:

xrandr --output DP-0 --off --output VGA-0 --auto

To activate only the VGA one and deactivate the laptop's:

xrandr --output VGA-0 --auto --output DP-0 --off

I don't have a third display to connect, but if your third display is called DP-1 you can set up a cron job to switch displays at a certain time like this:

## Activate VGA-0 at 6am
0 6 * * * xrandr --output VGA-0 --auto --output DP-0 --off --output DP-1 --off
## Activate DP-0 at 1pm
0 13 * * * xrandr --output VGA-0 --off --output DP-0 --auto --output DP-1 --off
## Activate DP-1 at 5pm
0 17 * * * xrandr --output VGA-0 --off --output DP-0 --off --output DP-1 --auto

You said you want this to run when no user is logged in, since a user must always be logged in when the system is up and running, I am not sure what you mean. However, if you set the cron as root (by running crontab -e when logged in as root or with sudo), then the job will be run even when no normal user is logged in.

share|improve this answer
add comment

If you couple MultiMonitorTool with Task Scheduler you should be able to achieve your rotation. I haven't used it before but according to it's command line options it should work. A possible command from the command line could look like this:

MultiMonitorTool.exe /enable 1 /SetPrimary 1 /disable 2 3

There's also an option to move existing windows to the new primary display:

/MoveWindow

You may also want to look into the /SetNextPrimary option.

This solution is, of course, Windows only.

share|improve this answer
    
Will this work even before the user has been logged in? –  artistoex May 27 '13 at 11:43
    
Maybe. I haven't done a lot with the Task Scheduler. If there's an option to run tasks with no user logged on it might just work. Maybe somebody else can jump in here? // edit: Looks like there's an option called "Run whether user is logged on or not". Apparently, you can't run interactive tasks but that shouldn't be an issue here. –  JC2k8 May 27 '13 at 11:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.