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
- Host: GitHub
- URL: https://github.com/lukapeschke/monitor-status
- Owner: lukapeschke
- Created: 2017-12-28T11:24:39.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-16T17:10:00.000Z (over 8 years ago)
- Last Synced: 2024-12-27T21:41:39.815Z (over 1 year ago)
- Topics: golang, i3wm, udev
- Language: Go
- Homepage:
- Size: 4.88 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
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.