- Notifications
You must be signed in to change notification settings - Fork6
Manage monitor configuration automatically.
License
rliou92/python-umonitor
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Manage monitor configuration automatically
The goal of this project is to implementdesktop environment independent dynamic monitormanagement. Dynamic monitor management means that the positions and resolutionsof the monitors will automatically be updated whenever monitors arehotplugged. This program is written in Cython using XCB to directly communicate with the X11 server. This program is targeted at users who are using a window manager on a laptop who hotplug monitors frequently.
Runpython setup.py install. Then runningumonitor should work.
For Arch Linux users there is an AUR packagehere.
- Setup your monitor resolutions and positions using
xrandror related tools (arandris a good one). - Run
umonitor --save <profile_name>. - Run
umonitor --listen --daemonizeto daemonize the program and begin automatically applying monitor setup.
The configuration file is stored in~/.config/umon/umon.conf. You can load aprofile manually by executingumonitor --load <profile_name>. Profiles can be deletedumonitor --delete <profile_name>.
umonitor runs all scripts automatically in~/.config/umon after a profile has been loaded. An example script that I use can be seen intoggle_media.py.
Example scenario: You are working on a laptop. You want to save the monitorconfiguration of just the laptop screen into the profile name called 'home'. Athome you plug in an external monitor, and you want to save that configuration as'docked'.
# With only the laptop screen (no external monitors)$ umonitor --save homeProfile home saved!# Plug in external monitor# Setup your desired configuration$ xrandr --output HDMI-1 --mode 1920x1080 --pos 1600x0$ xrandr --output eDP1 --mode 1600x900 --pos 0x0# Save the current configuration into a profile$ umonitor --save dockedProfile docked saved!# Begin autodetecting changes in monitor$ umonitor --listenhomedocked*---------------------------------# Monitor is unpluggedhome*docked---------------------------------Program help can be viewed throughumonitor --help.
$ umonitor --helpusage: umonitor [-h] [-w | -s PROFILE | -l PROFILE | -d PROFILE | -a | -n | -g] [--dry_run] [-v] [-f] [--daemonize]Manage monitor configuration.optional arguments: -h, --help show this help message and exit -w, --view view configuration file -s PROFILE, --save PROFILE saves current setup into profile name -l PROFILE, --load PROFILE load setup from profile name -d PROFILE, --delete PROFILE delete profile name from configuration file -a, --autoload load profile that matches with current configuration once -n, --listen listens for changes in the setup, and applies the new configuration automatically -g, --get_active_profile returns current active profile --dry_run run program without changing configuration -v, --verbose set verbosity level, 1 = info, 2 = debug -f, --force disable all outputs even if they do not change during loading --daemonize daemonize when listening to events --no_exec do not run scripts after loading of a profile is finished --no_poll do not poll for monitor change event, instead use a blocking callIf you would like to auto start this program, you can add the program to your .xinitrc:
$ cat ~/.xinitrc#!/bin/sh.........umonitor --listen --daemonizeexec i3 # your window manager of choiceGive me some feedback!
- What is saved and applied dynamically:
- Monitor vendor name + model number
- Crtc x and y position
- Resolution and refresh rate
- Primary output
- Rotation
- Runs scripts in
~/.config/umonwith the currently loaded parameter stored in the environment variableUMONITOR_PROFILE. - Valgrind clean
Bugs:
- Tell me! Run umonitor with the
--verboseflag to get debugging output
I'm open for any feature requests!
This is a Python rewrite of my earlier programumonitor, which was written in C. A higher level language such as Python allows quicker development times and easier maintenance.
I borrowed the edid parsing code fromeds.
About
Manage monitor configuration automatically.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.