Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Manage monitor configuration automatically.

License

NotificationsYou must be signed in to change notification settings

rliou92/python-umonitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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.

Installation

Runpython setup.py install. Then runningumonitor should work.

For Arch Linux users there is an AUR packagehere.

Usage

  • Setup your monitor resolutions and positions usingxrandr or related tools (arandr is a good one).
  • Runumonitor --save <profile_name>.
  • Runumonitor --listen --daemonize to 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 call

If 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 choice

Features

Give 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/umon with the currently loaded parameter stored in the environment variableUMONITOR_PROFILE.
  • Valgrind clean

Bugs:

  • Tell me! Run umonitor with the--verbose flag to get debugging output

I'm open for any feature requests!

About

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.

Credits

I borrowed the edid parsing code fromeds.

About

Manage monitor configuration automatically.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp