From 8cbadb61604667b407b53ee1258433994fa4765a Mon Sep 17 00:00:00 2001 From: coasteen Date: Thu, 9 Jul 2026 10:42:28 +0330 Subject: init --- local/bin/yellusb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 local/bin/yellusb (limited to 'local/bin/yellusb') 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 -- cgit v1.2.3