An open API service indexing awesome lists of open source software.

https://github.com/lukapeschke/monitor-status

A tool to handle udev events
https://github.com/lukapeschke/monitor-status

golang i3wm udev

Last synced: 8 months ago
JSON representation

A tool to handle udev events

Awesome Lists containing this project

README

          

==============
monitor-status
==============

``monitor-status`` (please do a PR if you have a better name) is a tool which
allows to watch for udev events. It was initially written to reset my i3
worspaces when a monitor is plugged in, but it can be used for any kind of
device.

It's still work in progress.

Installing and running
======================

There are no binary packages yet, but the tootl can easily be built.
Dependencies are ``go`` (1.8 or higher version) and ``libudev-dev``
(``systemd-devel`` on Fedora).

Once the depencies are installed, simply run ``go get
github.com/lukapeschke/monitor-status`` and you're good to go.

Installing with docker
======================

If you don't want to install go and dependencies, you can build this with
docker. A service file will also be generated::

$ git clone https://github.com/lukapeschke/monitor-status
$ cd monitor-status
# The image is also available on the docker hub, this step isn't mandatory
$ docker build -t lukapeschke/monitor-status .
$ docker run --rm -v $PWD:/root/monitor-status lukapeschke/monitor-status $USER
$ ./install.sh
$ sudo systemctl daemon-reload
$ sudo systemctl start monitor-status

The service should now be enabled and running.

Configuration
=============

The tool will look for a config file in the following places::

"./config.yml",
"~/.monitor-status/config.yml",
"~/.config/monitor-status.yml",
"~/.config/monitor-status/config.yml",
"$GOPATH/src/github.com/lukapeschke/monitor-status/config.yml"

If your config file is located elsewhere, you can specify its path with the
``-config`` flag.

The config file has the following format::

drm: # subsystem
card0-DP-3: # device
on_connect: ~/bin/reset_workspaces.sh # command for "add" event
on_disconnect: xrandr --output DP-1-1 --off # command for "remove" event
DEVICE2:
on_connect: echo "hello world!"
on_disconnect: echo "bye!"
SUBSYSTEM2:
[...]

For now, only ``on_connect`` and ``on_disconnect`` are supported, but more
events will be supported in the future.