0

I have two multi-monitor setups One at work, and one at home. Every time I come home or go to work, I need to load the NVIDIA GUI and manually set up my multi-monitor configuration. The NVIDIA GUI allows you to save the xorg.conf. I therefore would like two bash scripts, one for each setup, that I could run when arriving at home, or at work - so that I wouldn't have to do this step manually each day. Any ideas how to do that?

  • Why are you using nvidia app to configure monitors? Do you really need manual xorg.conf? I think that better idea could be to detect your extra monitor with udev rule and use xrandr to adjust your configuration. – muktupavels Feb 20 '17 at 20:11
1

You would have to reload lightdm after changing xorg.conf file, that means all open windows will close, so keep that in mind when running the script.

#!/bin/bash
cp /your/xorg/file.conf /etc/X11/xorg.conf
service lightdm restart

Save one version for each /your/xorg/file.conf location and run accordingly.

Edit: Don't forget to run as root!

| improve this answer | |
0

You could use custom xserver-command to start xserver. Default xserver-command is available in /usr/share/lightdm/lightdm.conf.d/50-xserver-command.conf.

Create script that will execute xserver-command. For example create /opt/my-xserver-command.sh with following content:

#!/bin/bash
X -core

Then copy /usr/share/lightdm/lightdm.conf.d/50-xserver-command.conf file to /etc/lightdm/lightdm.conf.d/50-xserver-command.conf and change xserver-command=X -core to xserver-command=/opt/my-xserver-command.sh

Now you can pass X your config file. For example:

#!/bin/bash
X -core -config xorg.conf

You can name your config files watever you want. For example work.conf and home.conf. Now you just need to find something to use to decide what config to use. For example you could detect current time and choose config based on that.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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