# DnDBuster A timer that notifies you - even if "do not disturb" is enabled. ## ToC * [DnDBuster](#dndbuster) * [ToC](#toc) * [Application IDs](#application-ids) * [.desktop entry](#desktop-entry) * [GTK resources](#gtk-resources) * [mypy](#mypy) * [Alternatives](#alternatives) ## Application IDs https://developer.gnome.org/documentation/tutorials/application-id.html Used by - GtkApplication > identifying your application to the system, for ensuring that only one instance of your application is running at a given time, and as a way of passing messages to your application - D-Bus > to name your application on the message bus. This is the primary means of communicating between applications - name of the .desktop file for your application > This file is how you describe your application to the system (so that it can be displayed in and launched by GNOME). ## .desktop entry https://wiki.gnome.org/HowDoI/GNotification The GNOME desktop environment needs a `.desktop` file that matches your applications ID. Otherwise, sent notifications are not displayed! > Warning: gnome-shell uses desktop files to find extra information (app icon, name) about the sender of the notification. If you don't have a desktop file whose base name matches the application id, then your notification will not show up. During development, we created a dummy vile at `~/.local/share/applications/de.p1st.dndbuster.desktop` with content: ``` [Desktop Entry] Name=DnDBuster Comment=A simple timer app Exec=nix-shell /home/yoda/Downloads/git/DnDBuster-python/shell.nix --run 'export PYTHONPATH="${PYTHONPATH}:/home/yoda/Downloads/git/DnDBuster-python/src" && python /home/yoda/Downloads/git/DnDBuster-python/src/dndbuster/main.py' Icon=dndbuster-stopwatch Terminal=false Type=Application Categories=Application; ``` Copy `watch-icon.svg` to `~/.local/share/icons/hicolor/scalable/apps/dndbuster-stopwatch.svg` ## GTK resources - https://www.gtk.org/docs/language-bindings/python - https://gitlab.gnome.org/GNOME/pygobject/-/tags - https://gitlab.gnome.org/GNOME/libadwaita/-/tags - https://pygobject.gnome.org/tutorials/gtk4/application.html#actions - These actions can be grouped together into a `Gio.ActionGroup` and when these groups are added to a widget with `Gtk.Widget.insert_action_group()` they will gain a prefix. Such as “win” when added to a `Gtk.ApplicationWindow`. You will use the full action name when referencing it such as “app.about” but when you create the action it will just be “about” until added to the application. - https://www.technett.io/post/dev/python-gtk-2/ - https://github.com/Taiko2k/GTK4PythonTutorial - https://github.com/timlau/gtk4-python - https://github.com/ToshioCP/Gtk4-tutorial ## mypy https://mypy.readthedocs.io/en/latest/getting_started.html ```shell mypy src/dndbuster/app.py ``` ## Alternatives https://man.archlinux.org/man/notify-send.1.en ```shell nix-shell -p libnotify ``` ```shell sleep 30m notify-send -u critical -a PleaseDisturbTimer "Timeout" "The time is over and your do-not-disturb mode just got busted!" ```