XPLUGD(1) (urm)
XPLUGD(1) General Commands Manual (urm) XPLUGD(1)

an X input/output plug in/out helper

xplugd [
] [
] [FILE]

xplugd is a daemon that executes a script on X input and RandR changes, i.e., if a keyboard, mouse or monitor is plugged in or unplugged. Useful if you want to run xrandr(1), xinput(1), or setxkbmap(1) when docking or undocking a laptop.
By default xplugd forks to the background and exits when the X server exits.

Print help and exit
Set log level for syslog messages, where LVL is one of: none, err, info, notice, debug. Use -l debug to enable debug messages. Default: notice
Run in foreground, do not detach from calling terminal and fork to background
Probe currently connected outputs and output EDID info
Use syslog, even if running in foreground, default w/o -n
Show version information and exit
The optional FILE argument defaults to $XDG_CONFIG_HOME/xplugrc, with fallbacks to ~/.config/xplugrc and ~/.xplugrc. The file is called as a script on plug events with the following arguments:
$1 = TYPE
One of display | keyboard | pointer
Usually HDMI3, LVDS1, VGA1, or an xinput(1) device number.
One of connected | disconnected | unknown
An optional description enclosed in double quotes, e.g., keyboard (manufacturer and) model name, or if EDID data is available from a connected display, the monitor model

Here is an example of how to use xplugd:
When xplugd starts it looks for the file ~/.config/xplugrc, which may look something like this:
case "$type,$device,$status,$desc" in 
        xrandr --output DVI-0 --auto --right-of LVDS 
        xrandr --output VGA-0 --auto --left-of LVDS 
  pointer,*,connected,"SynPS/2 Synaptics TouchPad") 
        xinput set-prop $device 'Synaptics Off' 1 
        setxkbmap -option ctrl:nocaps 

Primary path
Secondary path
Fallback path, for compat with earlier releases


xplugd was created by Joachim Nilsson in 2016 for use with window managers like awesome(1) and i3(1). It would however not exist if not for the hard work of Stefan Bolte with srandrd and Andrew Shadura with inputplug.
July 8, 2020 Debian