2

I recently bought an external monitor which I use in Portrait mode attached to my laptop. With quite some regularity I have to connect/disconnect it monitor (I work at home and often need to move to another room).

But this means that every time that I have to connect/disconnect it, I have to reset it with the display manager. And that means doing quite a number of clicks and wait a few annoying seconds between each click.: first to activate the external monitor, then to rotate it 90 degrees, and then to place it on the left of the monitor (or to turn the laptop off).

Is there a way that I can expedite this, either by having the display manager remember some of my configurations or by writing a command script that I can just invoke and which will set up up my monitor in one single command/click?

I am using Xubuntu, so please let me know if this response is exclusive to this distribution (I suspect that it is not).

Thanks in advance.

Santiago.

SaMeji
  • 121
  • That is very well possible, You can simply create a command and add it to a key combination, or run a tiny background script keeping an eye on wether the screen is attached or not. Do you know the screen's name? (it is in the output of xrandr)? – Jacob Vlijm May 02 '15 at 20:36
  • See the dupe to create the command... – Jacob Vlijm May 02 '15 at 20:47

2 Answers2

5

Thanks. Jacob's solution is just what I was looking for.

<screen> is meant to replace the specific input that you need to provide to xrandr. To find out what that name of the input is, look at the first acronym that appears just before the list of numbers when you run xrandr. In my case these were LVDS1 and VGA1 (the first is my laptop, the second my external monitor).

In case anyone is interested, here are the four commands that I used for the four items I added to a panel's launcher:

xrandr --output VGA1 --auto --rotate left --left-of LVDS1 (This rotates my monitor in portrait mode, keeping it to the left of my laptop's monitor)

xrandr --output VGA1 --auto --rotate normal --left-of LVDS1 (This rotates my external monitor horizontally, say because I want to watch a video. It also keeps it to the left of my monitor).

xrandr --output LVDS1 --auto --right-of VGA1 (This turns on my laptop monitor, placing it to the right of my external monitor)

xrandr --output LVDS1 --off (This turns off my laptop monitor)

SaMeji
  • 121
0

https://apps.ubuntu.com/cat/applications/precise/arandr/

ARandR is a visual front end for XRandR 1.2/1.3 (per display options), which provides full controll over positioning, saving and loading to/from shell scripts and easy integration with other applications.

This is a program that allows you to save scripts. In turn, this eliminates having to set it up constantly.

  • Seems like a huge detour, since the command to rotate the second screen is one very short line: xrandr --output <screen> --rotate left. Put it under a key and you're done. – Jacob Vlijm May 02 '15 at 21:21
  • It's the same thing. Just with a GUI. – funkybananna82 May 02 '15 at 21:49
  • Thanks. The second alternative is just what I was looking for. However, I am not sure how to know how to find out the name of my screen that I need to pass to xrandr (i.e. I don't know what to write instead of ) – SaMeji May 02 '15 at 23:55
  • 1
    OK.... Found it. – SaMeji May 03 '15 at 00:00
  • just for everyone's help, "xrandr --listmonitors" command will tell you names of your monitors. – Yogee Aug 02 '20 at 12:23