troglobit / xplugd

Monitor, keyboard, and mouse plug/unplug helper for X
MIT License
64 stars 4 forks source link

xplugrc fires twice on connect or disconnect #8

Open willbelr opened 3 years ago

willbelr commented 3 years ago

The following script (.xplugrc) execute twice on connection or disconnection of DP2-1;

#!/bin/sh
monitor=DP2-1
case "$1,$2,$3" in
  display,$monitor,connected)
    urxvt --hold;;
  display,$monitor,disconnected)
    xterm -hold;;
esac

The event also appear twice. What could I do as a workaround?

$ xplugd -n -l debug
xplugd[76595]: Event: DP2-1 connected
xplugd[76595]: Time: 4144125
xplugd[76595]: Size: 800mm x 330mm
xplugd[76595]: MODEL: DELL U3415W S/N: PXF7905E0M2L EXTRA: 
xplugd[76595]: Calling /home/user/.xplugrc display DP2-1 connected DELL U3415W
xplugd[76595]: Started /home/user/.xplugrc as PID 77318
xplugd[76595]: Event: DP2-2 disconnected
xplugd[76595]: Time: 4144125
xplugd[76595]: Size: 0mm x 0mm
xplugd[76595]: Calling /home/user/.xplugrc display DP2-2 disconnected 
xplugd[76595]: Started /home/user/.xplugrc as PID 77319
xplugd[76595]: Event: DP2-3 disconnected
xplugd[76595]: Time: 4144125
xplugd[76595]: Size: 0mm x 0mm
xplugd[76595]: Calling /home/user/.xplugrc display DP2-3 disconnected 
xplugd[76595]: Started /home/user/.xplugrc as PID 77321
xplugd[76595]: Event: DP2-1 connected
xplugd[76595]: Time: 4144125
xplugd[76595]: Size: 800mm x 330mm
xplugd[76595]: MODEL: DELL U3415W S/N: PXF7905E0M2L EXTRA: 
xplugd[76595]: Calling /home/user/.xplugrc display DP2-1 connected DELL U3415W
xplugd[76595]: Started /home/user/.xplugrc as PID 77322
xplugd[76595]: Collected PID 77319
xplugd[76595]: Collected PID 77321
xplugd[76595]: Skipping dev 14 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Skipping dev 14 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Skipping dev 14 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Skipping dev 14 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Skipping dev 14 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Skipping dev 14 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Skipping dev 14 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Skipping dev 14 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Skipping dev 14 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Skipping dev 14 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Skipping dev 14 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Skipping dev 14 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Skipping dev 14 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Skipping dev 14 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Skipping dev 14 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Skipping dev 14 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Calling /home/user/.xplugrc keyboard 14 connected MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Started /home/user/.xplugrc as PID 77612
xplugd[76595]: Skipping dev 15 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse System Control
xplugd[76595]: Skipping dev 15 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse System Control
xplugd[76595]: Skipping dev 15 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse System Control
xplugd[76595]: Skipping dev 15 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse System Control
xplugd[76595]: Skipping dev 15 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse System Control
xplugd[76595]: Skipping dev 15 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse System Control
xplugd[76595]: Skipping dev 15 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse System Control
xplugd[76595]: Skipping dev 15 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse System Control
xplugd[76595]: Skipping dev 15 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse System Control
xplugd[76595]: Skipping dev 15 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse System Control
xplugd[76595]: Skipping dev 15 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse System Control
xplugd[76595]: Skipping dev 15 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse System Control
xplugd[76595]: Skipping dev 15 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse System Control
xplugd[76595]: Skipping dev 15 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse System Control
xplugd[76595]: Skipping dev 15 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse System Control
xplugd[76595]: Skipping dev 15 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse System Control
xplugd[76595]: Calling /home/user/.xplugrc keyboard 15 connected MOSART Semi. 2.4G Keyboard Mouse System Control
xplugd[76595]: Started /home/user/.xplugrc as PID 77613
xplugd[76595]: Skipping dev 16 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Skipping dev 16 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Skipping dev 16 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Skipping dev 16 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Skipping dev 16 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Skipping dev 16 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Skipping dev 16 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Skipping dev 16 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Skipping dev 16 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Skipping dev 16 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Skipping dev 16 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Skipping dev 16 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Skipping dev 16 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Skipping dev 16 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Skipping dev 16 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Collected PID 77612
xplugd[76595]: Skipping dev 16 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Calling /home/user/.xplugrc pointer 16 connected MOSART Semi. 2.4G Keyboard Mouse
xplugd[76595]: Started /home/user/.xplugrc as PID 77614
xplugd[76595]: Collected PID 77613
xplugd[76595]: Collected PID 77614
xplugd[76595]: Skipping dev 17 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 17 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 17 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 17 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 17 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 17 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 17 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 17 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 17 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 17 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 17 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 17 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 17 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 17 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 17 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 17 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Calling /home/user/.xplugrc pointer 17 connected MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Started /home/user/.xplugrc as PID 77615
xplugd[76595]: Skipping dev 18 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 18 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 18 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 18 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 18 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 18 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 18 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 18 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 18 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 18 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 18 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 18 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 18 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 18 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 18 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Skipping dev 18 type XIFloatingSlave flags XISlaveAdded name MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Calling /home/user/.xplugrc keyboard 18 connected MOSART Semi. 2.4G Keyboard Mouse Consumer Control
xplugd[76595]: Started /home/user/.xplugrc as PID 77616
xplugd[76595]: Collected PID 77615
xplugd[76595]: Collected PID 77616
xplugd[76595]: Event: DP2-1 disconnected
xplugd[76595]: Time: 4144125
xplugd[76595]: Size: 0mm x 0mm
xplugd[76595]: Calling /home/user/.xplugrc display DP2-1 disconnected 
xplugd[76595]: Started /home/user/.xplugrc as PID 77686
xplugd[76595]: Event: DP2-2 disconnected
xplugd[76595]: Time: 4144125
xplugd[76595]: Size: 0mm x 0mm
xplugd[76595]: Calling /home/user/.xplugrc display DP2-2 disconnected 
xplugd[76595]: Started /home/user/.xplugrc as PID 77691
xplugd[76595]: Event: DP2-3 disconnected
xplugd[76595]: Time: 4144125
xplugd[76595]: Size: 0mm x 0mm
xplugd[76595]: Calling /home/user/.xplugrc display DP2-3 disconnected 
xplugd[76595]: Started /home/user/.xplugrc as PID 77692
xplugd[76595]: Event: DP2-1 disconnected
xplugd[76595]: Time: 4144125
xplugd[76595]: Size: 0mm x 0mm
xplugd[76595]: Calling /home/user/.xplugrc display DP2-1 disconnected 
xplugd[76595]: Started /home/user/.xplugrc as PID 77693
xplugd[76595]: Calling /home/user/.xplugrc keyboard 14 disconnected 
xplugd[76595]: Started /home/user/.xplugrc as PID 77694
xplugd[76595]: Collected PID 77692
xplugd[76595]: Collected PID 77694
xplugd[76595]: Skipping dev 14 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 14 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 14 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 14 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 14 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 14 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 14 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 14 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 14 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 14 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 14 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 14 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 14 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 14 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 14 type  flags XISlaveRemoved name <none>
xplugd[76595]: Collected PID 77691
xplugd[76595]: Skipping dev 14 type  flags XISlaveRemoved name <none>
xplugd[76595]: Calling /home/user/.xplugrc pointer 16 disconnected 
xplugd[76595]: Started /home/user/.xplugrc as PID 77698
xplugd[76595]: Skipping dev 16 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 16 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 16 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 16 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 16 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 16 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 16 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 16 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 16 type  flags XISlaveRemoved name <none>
xplugd[76595]: Collected PID 77698
xplugd[76595]: Skipping dev 16 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 16 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 16 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 16 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 16 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 16 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 16 type  flags XISlaveRemoved name <none>
xplugd[76595]: Calling /home/user/.xplugrc pointer 17 disconnected 
xplugd[76595]: Started /home/user/.xplugrc as PID 77702
xplugd[76595]: Skipping dev 17 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 17 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 17 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 17 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 17 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 17 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 17 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 17 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 17 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 17 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 17 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 17 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 17 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 17 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 17 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 17 type  flags XISlaveRemoved name <none>
xplugd[76595]: Calling /home/user/.xplugrc keyboard 18 disconnected 
xplugd[76595]: Started /home/user/.xplugrc as PID 77703
xplugd[76595]: Skipping dev 18 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 18 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 18 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 18 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 18 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 18 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 18 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 18 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 18 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 18 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 18 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 18 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 18 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 18 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 18 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 18 type  flags XISlaveRemoved name <none>
xplugd[76595]: Collected PID 77702
xplugd[76595]: Collected PID 77703
xplugd[76595]: Calling /home/user/.xplugrc keyboard 15 disconnected 
xplugd[76595]: Started /home/user/.xplugrc as PID 77717
xplugd[76595]: Skipping dev 15 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 15 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 15 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 15 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 15 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 15 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 15 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 15 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 15 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 15 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 15 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 15 type  flags XISlaveRemoved name <none>
xplugd[76595]: Collected PID 77717
xplugd[76595]: Skipping dev 15 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 15 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 15 type  flags XISlaveRemoved name <none>
xplugd[76595]: Skipping dev 15 type  flags XISlaveRemoved name <none>
xplugd[76595]: Collected PID 77686
xplugd[76595]: Collected PID 77322
xplugd[76595]: Collected PID 77693
xplugd[76595]: Collected PID 77318

System infos;

$ inxi -Fxy
System:
  Kernel: 5.10.36-1-lts x86_64 bits: 64 compiler: gcc v: 10.2.0 
  Desktop: Openbox 3.6.1 Distro: Arch Linux 
Machine:
  Type: Laptop System: LENOVO product: 20CM0048US v: ThinkPad X250 
  serial: <filter> 
  Mobo: LENOVO model: 20CM0048US v: SDK0E50510 WIN serial: <filter> 
  UEFI: LENOVO v: N10ET59W (1.38 ) date: 08/15/2019 
Battery:
  ID-1: BAT0 charge: 6.0 Wh (54.5%) condition: 11.0/23.5 Wh (46.8%) 
  volts: 11.6 min: 11.4 model: LGC 45N1113 status: Discharging 
  ID-2: BAT1 charge: 1.0 Wh (5.5%) condition: 18.2/23.5 Wh (77.7%) 
  volts: 11.2 min: 11.4 model: LGC 45N1127 status: Unknown 
CPU:
  Info: Dual Core model: Intel Core i7-5600U bits: 64 type: MT MCP 
  arch: Broadwell rev: 4 cache: L2: 4 MiB 
  flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx 
  bogomips: 20752 
  Speed: 2595 MHz min/max: 500/3200 MHz Core speeds (MHz): 1: 2595 2: 2593 
  3: 2596 4: 2597 
Graphics:
  Device-1: Intel HD Graphics 5500 vendor: Lenovo driver: i915 v: kernel 
  bus-ID: 00:02.0 
  Device-2: Acer Integrated Camera type: USB driver: uvcvideo bus-ID: 2-8:4 
  Display: x11 server: X.Org 1.20.11 driver: loaded: intel 
  unloaded: modesetting resolution: 1366x768~60Hz 
  OpenGL: renderer: Mesa Intel HD Graphics 5500 (BDW GT2) v: 4.6 Mesa 21.1.0 
  direct render: Yes 
Audio:
  Device-1: Intel Broadwell-U Audio vendor: Lenovo driver: snd_hda_intel 
  v: kernel bus-ID: 00:03.0 
  Device-2: Intel Wildcat Point-LP High Definition Audio vendor: Lenovo 
  driver: snd_hda_intel v: kernel bus-ID: 00:1b.0 
  Sound Server-1: ALSA v: k5.10.36-1-lts running: yes 
  Sound Server-2: JACK v: 0.125.0 running: no 
  Sound Server-3: PulseAudio v: 14.2 running: yes 
Network:
  Device-1: Intel Ethernet I218-LM vendor: Lenovo driver: e1000e v: kernel 
  port: 3080 bus-ID: 00:19.0 
  IF: enp0s25 state: down mac: <filter> 
  Device-2: Intel Wireless 7265 driver: iwlwifi v: kernel port: efa0 
  bus-ID: 03:00.0 
  IF: wlp3s0 state: up mac: <filter> 
Bluetooth:
  Device-1: Intel Bluetooth wireless interface type: USB driver: btusb 
  v: 0.8 bus-ID: 2-7:3 
  Report: rfkill ID: hci0 rfk-id: 2 state: up address: see --recommends 
Drives:
  Local Storage: total: 922.21 GiB used: 793.2 GiB (86.0%) 
  ID-1: /dev/sda vendor: Seagate model: ST750LM022 HN-M750MBB 
  size: 698.64 GiB 
  ID-2: /dev/sdb model: SB2 size: 223.57 GiB 
Partition:
  ID-1: / size: 219.44 GiB used: 179.75 GiB (81.9%) fs: ext4 dev: /dev/sdb3 
  ID-2: /boot size: 511 MiB used: 104 MiB (20.4%) fs: vfat dev: /dev/sdb1 
Swap:
  ID-1: swap-1 type: file size: 2 GiB used: 0 KiB (0.0%) file: /swapfile 
Sensors:
  System Temperatures: cpu: 47.0 C mobo: 0.0 C 
  Fan Speeds (RPM): cpu: 3051 
Info:
  Processes: 171 Uptime: 1h 23m Memory: 7.67 GiB used: 1.76 GiB (22.9%) 
  Init: systemd Compilers: gcc: 10.2.0 clang: 11.1.0 Packages: 1303 
  Shell: Bash v: 5.1.8 inxi: 3.3.04
troglobit commented 3 years ago

Duplicate events, that must be very annoying. Don't think this is a problem with xplugd, but I could be wrong of course. I guess the only way to work around this would be to make your script idempotent, i.e., make it check your desired state first before trying to apply it.

willbelr commented 3 years ago

I hoped that there would be a better solution, but I could get it to behave correctly by using a lock file. Also I wanted to thank you for sharing this software, I found it much friendlier than udev for switching displays.

#!/bin/sh
event_handler() {
  monitor=DP2-1
  case "$1,$2,$3" in
    display,$monitor,connected)
      connected;;
    display,$monitor,disconnected)
      disconnected;;
  esac
}

connected() {
  xrandr --output eDP1 --off
  xrandr --output DP2-1 --primary --mode 3440x1440 --pos 0x0 --rotate normal --dpi 102x102
}

disconnected() {
  xrandr --output DP2-1 --off
  xrandr --output eDP1 --primary --mode 1366x768 --pos 0x0 --rotate normal --dpi 96x96
}

LOCK=/tmp/xplugd-lock-$2
if test -f "$LOCK"; then
  echo "! xplugrc: Execution prevented by lock file '$LOCK'"
else
  touch "$LOCK"
  event_handler $1 $2 $3
  rm "$LOCK"
fi