dockmonitortool
1 Changes
- 2017-04-23: Version 0.1 - initial version
| Status: | Works |
| Location: | https://github.com/perweij/dockmonitortool |
| Latest release: | https://github.com/perweij/dockmonitortool/releases |
2 Description
This is a trivially simple tool for automatically setting the right
display settings depending on whether your laptop is in the docking station or
not. It periodically monitors the dock file in sysfs, and if its
state changes it runs the corresponding display setting command.
This is most likely not useful for X11-users that run a heavy display manager such as Gnome or KDE, but if you are running a lightweight setup with only X11 and a minimal window manager such as dwm, evilwm etc, it can be most useful.
3 Setup
Before building, you need to adjust three constants in dockmonitortool.c.
#define DOCK <dockfile in sysfs>Specify the file in
sysfscorresponding to your dock. It is a file that contains integer 0 when no dock is present, and an integer with another value when a dock is present. This may vary between different hardware, so you need to find the file that is right for your system. On my laptop I use: =#define DOCK "/sys/devices/platform/hp-wmi/dock"=#define CMD_DOCKand#define CMD_NODOCKDefine the two
xrandrcommands which you use to set your preferred display settings when docked and undocked. If you are unsure what those commands are, you can use the programarandrto interactively adjust the display, and saving the resulting settings to a file containing the exactxrandrcommand line to use.
4 Install
autoreconf --install./configure (--prefix...)make all (install)
5 Usage
You can run it however you like from within your X11 session. The easiest way is to add it to your ~/.xinitrc:
nice dockmonitortool &