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

NAME

xplugdan X input/output plug in/out helper

SYNOPSIS

xplugd [-hnv] [-l LEVEL] [FILE]

DESCRIPTION

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.

OPTIONS

-h
Print help and exit
-l LVL
Set log level for syslog messages, where LVL is one of: none, err, info, notice, debug. Use -l debug to enable debug messages
-n
Run in foreground, do not detach from calling terminal and fork to background
-s
Use syslog, even if running in foreground, default w/o -n
-v
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 qoutes, only used for xinput(1) devices, like the keyboard manufacturer and model name.

EXAMPLE

Here is an example of how to use xplugd:
xplugd my-script.sh
Where my-script.sh could 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

FILES

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

SEE ALSO

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

AUTHORS

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.
April 19, 2019 Debian