slop coded extension that ensures DND is on in GNOME whenever I start sharing my screen.
- JavaScript 61.2%
- Nix 38.8%
| lib | ||
| tests | ||
| .gitignore | ||
| extension.js | ||
| flake.lock | ||
| flake.nix | ||
| metadata.json | ||
| README.md | ||
Do Not Disturb While Screen Sharing
A GNOME Shell extension that automatically turns on Do Not Disturb whenever you start sharing (or recording) your screen, and restores your previous notification setting as soon as the share ends. No more private notifications popping up in front of your audience.
How it works
- It listens to Mutter's remote-access controller
(
global.backend.get_remote_access_controller()), which emits a handle for every active screen-capture session — exactly the mechanism behind the little "screen is being shared" indicator in the top bar. - On the first active handle it flips
org.gnome.desktop.notifications show-bannerstofalse(the same key the Shell's own Do Not Disturb toggle uses), after saving the previous value. - Handles are reference-counted, so Do Not Disturb stays on until the last concurrent share stops, then the saved value is restored. If you already had Do Not Disturb on before sharing, it stays on.
Requirements
- GNOME Shell 45–49 (ESM extensions).
- Nix for the build/test tooling (flakes enabled).
Layout
| File | Purpose |
|---|---|
extension.js |
Shell entry point (wires the pieces to real Mutter/Gio APIs). |
lib/dndController.js |
Saves/restores the Do Not Disturb state. No Shell imports. |
lib/screenShareGuard.js |
Reference-counts capture handles and drives the controller. No Shell imports. |
tests/ |
Unit tests run under a bare gjs. |
flake.nix |
Dev shell, nix flake check (tests) and nix build (packaging). |
The two lib/ modules deliberately avoid resource:///org/gnome/shell/...
imports and communicate only through GObject signals / a settings-like object,
which is what makes them testable outside of a running Shell.
Testing
nix flake check # runs the unit test suite under gjs
# or, in a dev shell:
nix develop -c gjs -m tests/run.js
Building & installing
nix build .#default
gnome-extensions install --force \
result/share/gnome-shell/extensions/screenshare-dnd@rammhold.de.shell-extension.zip
# then log out/in (Wayland) or restart the Shell (Xorg: Alt+F2, r), and:
gnome-extensions enable screenshare-dnd@rammhold.de
You can also pack it directly from a dev shell with
nix develop -c gnome-extensions pack ..