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

xplugd
an X input/output plug in/out helper

xplugd [
-hnpsv
] [
-l LEVEL
] [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
LVL
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
$2 = DEVICE
Usually HDMI3, LVDS1, VGA1, or an xinput(1) device number.
$3 = STATUS
One of connected | disconnected | unknown
$4 = DESCRIPTION
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:
xplugd
When xplugd starts it looks for the file ~/.config/xplugrc, which may look something like this:
#!/bin/sh 
 
type=$1 
device=$2 
status=$3 
desc=$4 
 
case "$type,$device,$status,$desc" in 
  display,DVI-0,connected,*) 
        xrandr --output DVI-0 --auto --right-of LVDS 
        ;; 
  display,VGA-0,connected,*) 
        xrandr --output VGA-0 --auto --left-of LVDS 
        ;; 
  pointer,*,connected,"SynPS/2 Synaptics TouchPad") 
        xinput set-prop $device 'Synaptics Off' 1 
        ;; 
  keyboard,*connected,*) 
        setxkbmap -option ctrl:nocaps 
        ;; 
esac

$XDG_CONFIG_HOME/xplugrc
Primary path
~/.config/xplugrc
Secondary path
~/.xplugrc
Fallback path, for compat with earlier releases

⟨http://bitbucket.org/portix/srandrd⟩
 
⟨https://bitbucket.org/andrew_shadura/inputplug⟩
 
⟨https://github.com/troglobit/xplugd⟩
 

xplugd was created by Joachim Wiberg 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.
January 29, 2023 Debian