diff --git a/usbguard-notify.py b/usbguard-notify.py index ece0101..afdfead 100755 --- a/usbguard-notify.py +++ b/usbguard-notify.py @@ -54,26 +54,26 @@ def get_name_and_id_from_rule(rule): def prompt_device_action(dev_id, name, long_id): proc = Popen([DUNSTIFY_EXEC_NAME, '-p', - '-A', '2,Block', - '-A', '1,Allow', - '-A', '0,Reject', + '-A', 'block,Block', + '-A', 'allow,Allow', + '-A', 'reject,Reject', f'{name} ({long_id})', 'New Device'], stdout=PIPE, text=True, bufsize=0) open_notifications[dev_id] = int(proc.stdout.readline()) - option = int(proc.communicate()[0]) + option = proc.communicate()[0][:-1] try: open_notifications.pop(dev_id) except KeyError: pass match option: - case 0: + case 'reject': run([USBGUARD_EXEC_NAME, 'reject-device', long_id]) - case 1: + case 'allow': run([USBGUARD_EXEC_NAME, 'allow-device', long_id]) - case 2: + case _: run([USBGUARD_EXEC_NAME, 'block-device', long_id])