# Multi-monitor setup



## mefizto (Oct 4, 2020)

Greetings all,

I have an N-vidia card, a driver of which does support a multi-monitor setup.  I had two monitors working by invoking a command`xrandr --output VGA-0 --auto --output DVI-I-1 --auto --right-of VGA-0`.

Is there another way, _e.g._, by adding a configuration to /usr/local/etc/X11/xorg.conf.d, or somehow in the N-vidia settings?

Kindest regards,

M


----------



## ekvz (Oct 4, 2020)

I guess you could always just stick the command into .xinitrc (see xinit(1)). Not exactly elegant but it should work.


----------



## tingo (Oct 4, 2020)

In Xfce, I just configure how I want monitor layout in Settings/Display, then it comes up that way every time I start Xfce.


----------



## olli@ (Oct 4, 2020)

mefizto said:


> I have an N-vidia card, a driver of which does support a multi-monitor setup.  I had two monitors working by invoking a command`xrandr --output VGA-0 --auto --output DVI-I-1 --auto --right-of VGA-0`.
> 
> Is there another way, _e.g._, by adding a configuration to /usr/local/etc/X11/xorg.conf.d, or somehow in the N-vidia settings?


First, install x11/nvidia-settings (if you haven’t already done so) and run it. Check if it detects the monitors correctly. I think you can also configure multi-monitor mode there.


----------



## scottro (Oct 4, 2020)

I hate to confess it, but I also use nvidia-settings. It's a GUI app that allows you to move the monitors around the way you want them. (Hate to confess it because I'm embarrassed to admit I rely on a GUI app to get it the way I like it.)


----------



## mefizto (Oct 4, 2020)

Hi ekvz,

I though about it, but then the system will always come in multimode setup.  I would like to dynamically change it.  Sorry that I did not mention it.

Hi tingo,

I do not use XFCE.

Hi Olie, Scrotto,

I was unaware of the package, thank you for bringing it to my attention.  If it works like on Windows, I could change the setup _via _the package.

Kindest regards,

M


----------



## ekvz (Oct 4, 2020)

mefizto said:


> I though about it, but then the system will always come in multimode setup.  I would like to dynamically change it.



I see. Well, depending on what's offered by your WM you might be able to define some keybindings. Actually that's what i am using myself to switch from my laptop screen to an external monitor myself. As long as you don't need a ton of options that seems to be the most pragmatic approach since you already know how to archive your goal in terms of shell commands anyways.


----------



## mefizto (Oct 4, 2020)

Hi ekvz,

thank you for the suggestion, that is a great idea.  Could you give me some hints how you approached the keybindings?  This is a plain vanilla FreeBSD install.

Kindest regards,

M


----------



## ekvz (Oct 4, 2020)

mefizto said:


> Could you give me some hints how you approached the keybindings?  This is a plain vanilla FreeBSD install.



Well, this largely depends on your desktop environment/window manager. I could give you an example but it would only be meaningful if you use IceWM, which is unlikely i think. I guess you'll have to consult the manual of your DE/WM about this, sorry.


----------



## xtouqh (Oct 5, 2020)

I'd recommend against using nvidia-settings and keeping xrandr call in your ~/.xinitrc (depending on how you start X), as it's readable and already does what you need.


----------



## mefizto (Oct 5, 2020)

Hi ekvz,

yes, if it is WM dependent, it would not work as i am using Openbox.

Kindest regards,

M


----------



## Minbari (Oct 5, 2020)

If You don't want to use xrandr then You can create a file in /usr/local/etc/X11/xorg.conf.d/20-monitor.conf which has (e.g.):

```
Section "Monitor"
    Identifier  "VGA1"
    Modeline "1920x1080_60.00"
    Option      "Primary" "true"
    Option "DPMS" "true"
EndSection

Section "Monitor"
    Identifier  "HDMI1"
    Modeline "1920x1080_60.00"
    Option      "LeftOf" "VGA1"
    Option "DPMS" "true"
EndSection
```


----------



## mefizto (Oct 6, 2020)

Hi xthough, Minibari,

thank you for the suggestions, but they are static.  I will try to figure out the keybiding as ekvz suggested.

Kindest regards,

M


----------



## T-Daemon (Oct 6, 2020)

mefizto said:


> Hi ekvz,
> 
> thank you for the suggestion, that is a great idea.  Could you give me some hints how you approached the keybindings?  This is a plain vanilla FreeBSD install.



You can create keybindings  in Openbox's  ~/.config/openbox/rc.xml file. Put there xrandr(1) commands to dynamically change one monitor left/right to the other, syntax:

```
<keybind key="key-combination">
   <action name="Execute">
      <command>xrandr .....</command>
   </action>
</keybind>
```
or you can use a X hotkey daemon like x11/sxhkd.


----------



## Minbari (Oct 6, 2020)

mefizto said:


> Hi xthough, Minibari,
> 
> thank you for the suggestions, but they are static.  I will try to figure out the keybiding as ekvz suggested.
> 
> ...


You can use x11/xbindkeys for that. e.g:
$`xbindkeys -k`

```
m:0x4 + c:32
Control + o
m:0x4 + c:33
Control + p
```
.xbindkeysrc :

```
"xrandr --output VGA-0 --auto --output DVI-I-1 --auto --right-of VGA-0"
m:0x4 + c:32
Control+o
"xrandr --output DVI-I-1 --auto --output VGA-0 --auto --right-of DVI-I-1"
m:0x4 + c:33
Control+p
```

or if You want a "graphical" menu, x11/dmenu can  do that.
e.g.


----------



## mefizto (Oct 7, 2020)

Hi T-Daemon, Minibari,

thank you for al the specifics.  Now, the problem is, which of the great solutions to use.  

I think I will try the T-Daemon's as it appears to be most with the spirit of OpenBox.

Kindest regards,

M


----------

