This commit is contained in:
2026-07-12 08:16:17 +03:30
commit 72be1234e1
2027 changed files with 221388 additions and 0 deletions
+14
View File
@@ -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)