XPLUGD(1)

πŸ“¦ version 1.4, in nixos 26.05, nixpkgs unstable

πŸ’– XPLUGD(1) β€” the plug-in/plug-out bestie πŸ’–

ok so this is the manual page for xplugd, from the User's Reference Manual, and honestly? she's a little icon. let's get into it 🫢


✨ NAME ✨

xplugd β€” an X input/output plug in/out helper πŸ’…

like, literally a helper for when stuff gets plugged in and unplugged.


🌸 SYNOPSIS 🌸

xplugd [-hnpsv] [-l LEVEL] [FILE]

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so xplugd is a daemon that runs a script whenever your X input and RandR stuff changes β€” i.e. when a keyboard, mouse, or monitor gets plugged in or unplugged. no cap, that's the whole vibe check. πŸ‘‘

it's useful if you wanna run xrandr(1), xinput(1), or setxkbmap(1) when you're docking or undocking a laptop. the way that just works?? obsessed.

by default, xplugd forks to the background and exits when the X server exits. periodt. ✨


πŸŽ€ OPTIONS πŸŽ€

  • -h β€” print help and exit. short and sweet, she ate πŸ’…
  • -l LVL β€” set the log level for syslog messages, where LVL is one of: none, err, info, notice, debug. use -l debug to enable debug messages. default: notice πŸ“
  • -n β€” run in foreground, do not detach from the calling terminal and fork to background. main character energy, staying right there πŸ™ˆ
  • -p β€” probe currently connected outputs and output EDID info πŸ”βœ¨
  • -s β€” use syslog, even if running in foreground, default without -n πŸ“
  • -v β€” show version information and exit 🌈

so the optional FILE argument defaults to $XDG_CONFIG_HOME/xplugrc, with fallbacks to ~/.config/xplugrc and ~/.xplugrc. the file gets called as a script on plug events with these arguments, and yes bestie, every single one matters:

  • $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

πŸ’œ EXAMPLE πŸ’œ

here's an example of how to use xplugd β€” lowkey the cutest part of the whole page:

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

iykyk πŸ”₯


🧚 FILES 🧚

  • $XDG_CONFIG_HOME/xplugrc β€” Primary path πŸ‘‘
  • ~/.config/xplugrc β€” Secondary path ✨
  • ~/.xplugrc β€” Fallback path, for compat with earlier releases 🫢

⭐ SEE ALSO ⭐


🌸 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. legends only, fr fr πŸ’–


and that's the whole thing bestie, no notes πŸ’…

signing off from the Debian edition, dated Jul 8, 2020 β€” mwah, slay, see u in the group chat πŸŽ€πŸ’–βœ¨

πŸ“¦ where this page comes from