diff options
Diffstat (limited to 'local/bin/yellusb')
| -rwxr-xr-x | local/bin/yellusb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/local/bin/yellusb b/local/bin/yellusb new file mode 100755 index 0000000..1f53ecd --- /dev/null +++ b/local/bin/yellusb @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +import pyudev +import subprocess + +context = pyudev.Context() +monitor = pyudev.Monitor.from_netlink(context) +monitor.filter_by(subsystem='block') + +for device in iter(monitor.poll, None): + if device.action == 'add': + print(f"New device detected: {device.device_node}") + subprocess.run(f"notify-send 'New device connected: {device.device_node}'", shell=True)
\ No newline at end of file |
