diff --git a/bin/blob-notification-bell b/bin/blob-notification-bell new file mode 100755 index 0000000..c220167 --- /dev/null +++ b/bin/blob-notification-bell @@ -0,0 +1,10 @@ +#!/bin/bash + +# blob:summary=Print the bar bell for the notification centre as module JSON +# blob:hidden=true + +if [[ $(blob-shell notifications dndState 2>/dev/null) == on ]]; then + printf '{"text":"","tooltip":"Notifications silenced"}\n' +else + printf '{"text":"","tooltip":"Notifications"}\n' +fi diff --git a/config/blob/shell.json b/config/blob/shell.json index 21d19f0..f066c33 100644 --- a/config/blob/shell.json +++ b/config/blob/shell.json @@ -30,7 +30,17 @@ { "id": "blob.network" }, { "id": "blob.audio" }, { "id": "blob.monitor" }, - { "id": "blob.power" } + { "id": "blob.power" }, + { + "id": "blob.notifications", + "type": "command", + "exec": "blob-notification-bell", + "interval": 3, + "text": "\uf0f3", + "tooltip": "Notifications", + "onClick": "blob-shell shell toggle blob.notification-center", + "onRightClick": "blob-toggle-silencing" + } ] } }, diff --git a/docs/commands.md b/docs/commands.md index 517cc11..73793ac 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -333,6 +333,7 @@ of the `blob` listing. | Command | Does | Arguments | | --- | --- | --- | | `blob-notification-battery` | Show the current battery status notification | - | +| `blob-notification-bell` | Print the bar bell for the notification centre as module JSON (hidden) | - | | `blob-notification-time` | Show the current time and date notification | - | | `blob-notification-wait` | Wait for the desktop notification server to accept notifications (hidden) | [timeout-seconds] | | `blob-notification-weather` | Toggle the current weather panel | - | diff --git a/docs/shell.md b/docs/shell.md index 77a9f57..7d8c550 100644 --- a/docs/shell.md +++ b/docs/shell.md @@ -54,7 +54,9 @@ entirely rather than merging. `blob.clock` and `blob.notifications` are `type: "command"` modules, which is how they carry their own click actions: the clock opens quick settings on left click, the shell's calendar on middle, and the timezone picker on right; the bell opens -the notification centre on left and toggles silencing on right. +the notification centre on left and toggles silencing on right. The bell runs +`blob-notification-bell` every 3 seconds and turns into a crossed-out bell while +notifications are silenced. The centre module named by `centerAnchor` cannot be dragged out of the centre. Every other widget still reorders. diff --git a/docs/widgets.md b/docs/widgets.md index e2681bb..b356c56 100644 --- a/docs/widgets.md +++ b/docs/widgets.md @@ -38,7 +38,7 @@ falling back to `accent` for themes that define neither. `color0` is | Panel | Opened by | | --- | --- | | Quick settings | left-click the bar clock, or `Super + Ctrl + Q` | -| Notification centre | left-click the bar bell | +| Notification centre | left-click the bar bell; right-click silences notifications, and the bell is crossed out while they are | | System monitor | `Super + Ctrl + M` | Both new bar click actions are already in `shell.json`. The system monitor had no diff --git a/shell.json b/shell.json index 68ee79c..6c875ff 100644 --- a/shell.json +++ b/shell.json @@ -34,7 +34,9 @@ { "id": "blob.notifications", "type": "command", - "text": "", + "exec": "blob-notification-bell", + "interval": 3, + "text": "\uf0f3", "tooltip": "Notifications", "onClick": "blob-shell shell toggle blob.notification-center", "onRightClick": "blob-toggle-silencing"