March 25, 2019
How to fake a dual monitor setup using xrandr
A completely random but very friendly user named Elodin from the IRC-channel #i3 on the freenode network wrote a Python script for me. It’s a script that lets you fake an dual monitor setup on a single monitor setup. And it has been working really good for me so far!
It uses xrandr for the magic, the official configuration utility to the RandR. It’s a CLI-tool that can be used to set things like the size, orientation or the reflection of the outputs for a monitor.
If you’re thinking “Why?”, I suggest you reading my previous post: “I went from a multi monitor setup to just a single monitor setup”.
This is only tested with the i3 window manager, but it should (in theory) work with other window managers. If you try it with something else let me know how it went. :)
The script is a little more than 150 lines of code so I uploaded it to my git repo here. Download it and make it executable with
$ chmod +x mon.py.
Splitting the monitor
To split your monitor with the same ratio as seen in the screenshot:
$ ./mon.py split -r 70x30
If you don’t specify a value it should default to
||Show the help message|
||If you wish to put the focus back on the workspace where you where when you ran the script. This requires the Python-package
||Use this flag if you use i3 in order to reload the panels after splitting the monitor.|
||It’s also possible to pass your own commands like
Reverting back to one monitor
To revert back to a single monitor setup:
$ ./mon.py undo
- Tagged in: RandR | xrandr | Scripts | Utils | Command-line
- Previous post: I went from a multi monitor setup to just a single monitor setup
- Next post: How to upload files to NextCloud using only a shell script