dot
vizie's NixOS desktop: Hyprland, CachyOS kernel and gaming tweaks
| 1 | #!/usr/bin/env python3 |
| 2 | """Click on an entry in the Eww notifications panel: go to the app that sent it. |
| 3 | |
| 4 | Usage: open-notification.py <dunst notification id> |
| 5 | |
| 6 | Focuses the sending app's window (matched by app name against Hyprland's window |
| 7 | classes and titles), removes the entry from dunst's history and closes the panel. |
| 8 | If no window of that app is open, nothing happens and the entry stays. |
| 9 | |
| 10 | Dunst can't re-run the app's own action here: once a notification has left the |
| 11 | screen it has been reported to the app as closed, and dunst no longer signals |
| 12 | actions for it. That only works by clicking the pop-up while it is showing. |
| 13 | |
| 14 | Only the id comes from the panel; the app name is looked up in dunst's history, so |
| 15 | text chosen by whoever sent the notification never reaches a shell. |
| 16 | """ |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | = |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | return . |
| 28 | |
| 29 | return |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | = |
| 35 | |
| 36 | return |
| 37 | |
| 38 | |
| 39 | return |
| 40 | return |
| 41 | |
| 42 | |
| 43 | |
| 44 | """Best matching window for an app name, preferring the most recently focused.""" |
| 45 | = |
| 46 | |
| 47 | return None |
| 48 | |
| 49 | = |
| 50 | |
| 51 | return None |
| 52 | |
| 53 | |
| 54 | = |
| 55 | |
| 56 | return 3 |
| 57 | |
| 58 | return 2 |
| 59 | |
| 60 | return 1 |
| 61 | return 0 |
| 62 | |
| 63 | = |
| 64 | |
| 65 | return None |
| 66 | |
| 67 | return |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | = |
| 73 | |
| 74 | return 2 |
| 75 | |
| 76 | = |
| 77 | |
| 78 | return 1 |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | return 0 |
| 85 | |
| 86 | |
| 87 | |
| 88 | |