This guide will cover installation and basic usage of umonitor on Linux. umonitor is a dynamic monitor management written in C and distributed as a single binary package. The name dynamic monitor management means that the positions and resolutions of your screen monitors will be automatically updated whenever they are hotplugged.
We will use arch linux to install umonitor and see how to use it.
Installing umonitor
umonitor can be installed by generating a binary package from source files. For Arch Linux users, you can install umonitor from AUR using yaourt or a similar package manager.
Installing umonitor on Arch Linux
If you are running Arch Linux or any of its derivatives like Manjaro, you can easily install umonitor using AUR wrapper. Before you can use AUR, ensure the following lines is present in your
[archlinuxfr] SigLevel = Never Server = http://repo.archlinux.fr/$arch
Update package index and install umonitor,
$ sudo pacman -Sy :: Synchronizing package databases... core 145.0 KiB 780K/s 00:00 [##########################] 100% extra 1783.3 KiB 775K/s 00:02 [##########################] 100% community 4.7 MiB 659K/s 00:07 [##########################] 100% multilib 179.6 KiB 6.50M/s 00:00 [##########################] 100% archlinuxfr 11.5 KiB 0.00B/s 00:00 [##########################] 100%
Once updated, install umonitor using yaourt command line tool:
$ yaourt -S umonitor-git --noconfirm
You can confirm installed package status using:
$ pacman -Qi umonitor-git Name : umonitor-git Version : r161.06bff8e-1 Description : Dynamic monitor configuration Architecture : x86_64 URL : https://github.com/rliou92/umonitor Licenses : MIT Groups : None Provides : None Depends On : libconfig libxcb Optional Deps : None Required By : None Optional For : None Conflicts With : None Replaces : None Installed Size : 50.00 KiB Packager : Unknown Packager Build Date : Sat 16 Jun 2018 11:50:47 PM EAT Install Date : Sat 16 Jun 2018 11:50:48 PM EAT Install Reason : Explicitly installed Install Script : Yes Validated By : None
Installing umonitor on other Linux distributions
For other Linux distributions, you need to generate binary package from source code files. The basic dependency is cmake and git.
On Debian bases system, install git using:
$ sudo apt-get install software-properties-common $ sudo apt-get install gcc cmake $ sudo apt-get install git $ git clone https://github.com/rliou92/umonitor.git Cloning into 'umonitor'... remote: Counting objects: 5017, done. remote: Compressing objects: 100% (29/29), done. remote: Total 5017 (delta 32), reused 43 (delta 26), pack-reused 4962 Receiving objects: 100% (5017/5017), 11.48 MiB | 628.00 KiB/s, done. Resolving deltas: 100% (2519/2519), done.
For CentOS / RHEL / Fedora:
$ sudo yum install git gcc cmake $ sudo yum install git cmake # For Fedora $ git clone https://github.com/rliou92/umonitor.git Cloning into 'umonitor'... remote: Counting objects: 5017, done. remote: Compressing objects: 100% (29/29), done. remote: Total 5017 (delta 32), reused 43 (delta 26), pack-reused 4962 Receiving objects: 100% (5017/5017), 11.48 MiB | 628.00 KiB/s, done. Resolving deltas: 100% (2519/2519), done.
Then generate binary package using make command:
$ cd umonitor $ make gcc -Wall -c src/screen.c -o obj/screen.o gcc -Wall -c src/load.c -o obj/load.o gcc -Wall -c src/save.c -o obj/save.o gcc -Wall -c src/autoload.c -o obj/autoload.o gcc -Wall -c src/umonitor.c -o obj/umonitor.o gcc obj/screen.o obj/load.o obj/save.o obj/autoload.o obj/umonitor.o -Wall -lX11 -lxcb-randr -lxcb -lconfig -o bin/umonitor
The binary package will be placed on the directory ./bin
$ ls -1 bin umonitor
Make the file executable and copy the file to /usr/local/bin which is in $PATH
$ chmod +x ./bin/umonitor $ sudo cp bin/umonitor /usr/local/bin/
Umonitor Usage
To get basic help on how to use umonitor, run the command:
$ umonitor --help Usage: umonitor [OPTION] Options: -s,--save <profile_name> Saves current setup into profile_name -d,--delete <profile_name> Removes profile_name from configuration file -l,--load <profile_name> Loads setup from profile name -n,--listen Daemonizes, listens for changes in the setup, and applies the new configuration automatically -a,--autoload Load profile that matches with current configuration once --quiet Supress program output --help Display this help and exit --version Output version information and exit
You can set up your monitor resolutions and positions using the standard xrandr or arandr tools. Once comfortable with the settings, save them to a profile by executing:
$ umonitor --save <profile_name>
This will save:
- Monitor vendor name + model number
- Crtc x and y position
- Screen Resolution
- Primary output
- Rotation
The umonitor configuration file is stored in~/.config/umon.conf
The profile can also be loaded manually using
$ umonitor --load <profile_name>
To delete saved profile, use:
$ umonitor --delete <profile_name>
If you only have a single monitor - E.g Laptop screen, you can save resolutions and screen settings to a profile using the command:
$ umonitor --save laptop Profile home saved!
For external displays like HDMI, plugin in the device and configure it with xrandr, e.g
$ xrandr --output HDMI-1 --mode 1920x1080 --pos 1600x0 $ xrandr --output eDP1 --mode 1600x900 --pos 0x0
Then save the configurations to umonitor profile:
$ umonitor --save mymon Profile mymon saved!
Autodetecting Changes
Umonitor can do autodetection of changes, but you have to daemonize the application for this to happen. Just pass the --listen option to umonitor command.
$ umonitor --listen
Start umonitor on boot
To be able to start umonitor program on boot, add the following line to ~/.xinitrc
umonitor --listen --quiet
This can appear before loading your window manager or desktop environment session.
Resource Reference