summaryrefslogtreecommitdiff
path: root/local/bin/yellusb
diff options
context:
space:
mode:
authorcoasteen <coasteen@proton.me>2026-07-09 10:42:28 +0330
committercoasteen <coasteen@proton.me>2026-07-09 10:42:28 +0330
commit8cbadb61604667b407b53ee1258433994fa4765a (patch)
tree97765fb29418fd6278fcb4cbb9760893afaf7a58 /local/bin/yellusb
Diffstat (limited to 'local/bin/yellusb')
-rwxr-xr-xlocal/bin/yellusb14
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