Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/troglobit/xplugd
Monitor, keyboard, and mouse plug/unplug helper for X
https://github.com/troglobit/xplugd
awesomewm i3wm x x-server xrandr
Last synced: 4 months ago
JSON representation
Monitor, keyboard, and mouse plug/unplug helper for X
- Host: GitHub
- URL: https://github.com/troglobit/xplugd
- Owner: troglobit
- License: mit
- Created: 2016-03-29T10:16:13.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-01-29T08:00:00.000Z (almost 2 years ago)
- Last Synced: 2024-09-27T13:41:05.093Z (4 months ago)
- Topics: awesomewm, i3wm, x, x-server, xrandr
- Language: C
- Homepage:
- Size: 174 KB
- Stars: 64
- Watchers: 7
- Forks: 4
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
- License: LICENSE
Awesome Lists containing this project
- awesome-awesomewm-modules-widgets-and-libraries - xplugd
- awesome-awesomewm-modules-widgets-and-libraries - xplugd
README
xplugd - X plug daemon
======================
[![Travis Status][]][Travis] [![Coverity Status]][Coverity Scan]`xplugd` is a UNIX daemon that executes a script on X input and RandR
changes, i.e., when a, keyboard, mouse. or a monitor is plugged in or
unplugged. Useful in combination with lightweight setups, e.g. when
running an X window manager like [Awesome][1], Fluxbox, or similar to
detect when docking or undocking a laptop.Usage
-----xplugd [-hnpsv] [-l LEVEL] [FILE]
-h Show help text and exit
-l LEVEL Set log level: none, err, info, notice*, debug
-n Run in foreground, do not fork to background
-p Probe currently connected outputs and output EDID info.
-s Use syslog, even if running in foreground, default w/o -n
-v Show version info and exit
FILE Optional script argument, default $XDG_CONFIG_HOME/xplugrc
Fallback also checks for ~/.config/xplugrc and ~/.xplugrcWhen `FILE` is omitted `xplugd` uses `$XDG_CONFIG_HOME/xplugrc`, if that
cannot be found `~/.config/xplugrc` is tried, and finally `~/.xplugrc`.
The file is called as a shell script on plug events as follows:xplugrc TYPE DEVICE STATUS ["Optional Description"]
| | |
| | `---- connected or disconnected
| `----------- HDMI3, LVDS1, VGA1, etc.
`---------------- keyboard, pointer, displayThe script may be called like this, notice how the description is not
included for displays:xplugrc display HDMI3 disconnected
xplugrc keyboard 3 connected "Topre Corporation Realforce 87"The keyboard or pointer is always the X slave keyboard or pointer, and
the status encoding for `XIStatusEnabled` and `XIStatusDisabled` is
forwarded to the script as connected and disconnected, respectively.If EDID data is available from a connected display, the monitor model is
passed in as fourth argument ("Optional Description") to the script.### Example ~/.config/xplugrc
```sh
#!/bin/sh
LAPTOP=LVDS1
DOCK=HDMI3
DESKPOS=--left-of
PRESPOS=--right-ofif [ "$1" != "display" ]; then
case "$1,$3,$4" in
pointer,conntected,"SynPS/2 Synaptics TouchPad")
xinput set-prop $2 'Synaptics Off' 1
;;
keyboard,connected,*)
setxkbmap -option ctrl:nocaps
;;
esac
exit 0
fiif [ "$3" = "disconnected" ]; then
xrandr --output $2 --off
exit 0
fiif [ "$2" = "${DOCK}" ]; then
xrandr --output $2 --auto --primary ${DESKPOS} ${LAPTOP}
elif [ "$1" != "${LAPTOP}" ]; then
xrandr --output $2 --auto ${PRESPOS} ${LAPTOP} --primary
else
xrandr --auto
fi
```Build & Install
---------------To build `xplugd` you need the standard libraries and header files for
X11, X11 input, and Xrandr. On a Debian/Ubuntu system these files can
be installed with:sudo apt install libx11-dev libxi-dev libxrandr-dev
Then run the configure script and make:
./configure && make
Unless building from the GIT sources, in which case `./autogen.sh` first
must be called to create the configure script. With relased tarballs this
is not necessary.To change the default installation prefix from `/usr/local`, use the
./configure --prefix=/some/other/path
Followed by
make all && sudo make install-strip
Origin & References
-------------------[`xplugd`][2] is composed from pieces of Stefan Bolte's [`srandrd`][3]
and Andrew Shadura's [`inputplug`][4]. Please report bugs and problems
to the `xplugd` project.[1]: https://awesome.naquadah.org
[2]: https://github.com/troglobit/xplugd
[3]: https://bitbucket.org/portix/srandrd
[4]: https://bitbucket.org/andrew_shadura/inputplug
[Travis]: https://travis-ci.org/troglobit/xplugd
[Travis Status]: https://travis-ci.org/troglobit/xplugd.png?branch=master
[Coverity Scan]: https://scan.coverity.com/projects/10739
[Coverity Status]: https://scan.coverity.com/projects/10739/badge.svg