Volume widget issue with sound card hotplugging

You can achive what you want by using an udev rule that is written to act upon certain events. In this case these events are to plug usb sound card and to unplug it. According to this forum answer, possible solution is like following:

  1. Open the file that has usb sound card udev rules:

    sudo -H nautilus /etc/udev/rules.d/10-usb-sound-card.rules
    
  2. Paste and copy

    KERNEL=="pcmC[D0-9cp]*", ACTION=="add", PROGRAM="/bin/sh -c 'K=%k; K=$${K#pcmC}; K=$${K%%D*}; echo defaults.ctl.card $$K > /etc/asound.conf; echo defaults.pcm.card $$K >>/etc/asound.conf"
    
    KERNEL=="pcmC[D0-9cp]*", ACTION=="remove", PROGRAM="/bin/sh -c 'echo defaults.ctl.card 0 > /etc/asound.conf; echo defaults.pcm.card 0 >>/etc/asound.conf'"
    
  3. Save the file and give

    sudo udevadm trigger --action=add /etc/udev/rules.d/10-usb-sound-card.rules
    

command. Then test this rule by pluging and unpluging your usb sound card.

I hope this will help you.