I was using gnome-terminal on Fedora 40. There’s a feature where it sends a notification when a shell command completes while another window is focused.
I recently upgraded to Fedora 41, and now gnome-terminal no longer has this behavior, but the new default terminal (Ptyxis) does. I’ve confirmed it has this behavior regardless of whether it’s installed from the Fedora flatpak, RPM (sudo dnf install ptyxis
), or Flathub.
However, when I install Ptyxis from Flathub on Ubuntu 24.04, it does not have this behavior, even after I ensured that it has notification permissions in GNOME Settings and Flatseal.
So, I assume this is an extra feature that Fedora adds for its default terminal app in each Workstation release (or perhaps any terminal that supports it, I haven’t tested others), and I’m curious how it’s implemented, particularly because it’s also present in the Flathub version of Ptyxis on Fedora, which suggests that Fedora is somehow implementing this feature without patching its flatpak/RPM version of Ptyxis.
The behavior only works in bash (didn’t work when I ran a command in zsh), and this source suggests it involves setting PROMPT_COMMAND
in bash. I do see PROMPT_COMMAND
getting set in /etc/bashrc
, and if I run echo $PROMPT_COMMAND
, I get:
printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"
which doesn’t look relevant to this feature.
How is this feature implemented? Is it documented somewhere? Is there a way to get this behavior on other Linux distros?
I’ve found numerous discussions about this topic, but I haven’t been able to get a clear answer:
- Reddit - Dive into anything
- Reddit - Dive into anything
- Terminal notification not show up on gnome 46 (fedora 40)
- https://forums.opensuse.org/t/gnome-terminal-job-noticications/123584
- Bug 711059 – Notifications for long-running commands
- Terminal job notifications in Fedora 22 Workstation - Fedora Magazine
Edit: Also works with gnome-console
and blackbox-terminal
installed via dnf
, so it’s not specific to Ptyxis, though I don’t know why it no longer works with gnome-terminal
after upgrading to Fedora 41.
Edit 2: Just noticed that Black Box explicitly includes a “Notification on Completed Task” option which also works on Ubuntu, so Black Box must implement that feature itself. But I’m still curious how Fedora is implementing the feature for e.g. Ptyxis.