! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Notify when job finishes.
Status:
RESOLVED: MOVED
Severity:
enhancement
Product:
Xfce4-terminal
Component:
General

Comments

Description Simon 'The Sorcerer' 2019-09-07 02:49:30 CEST
When having long running jobs in background terminals it would be awesome to have a notification when the job finishes.
I already enabled the urgent notification (visual bell) and acoustic bell in the xfce4-terminal settings but somehow my window doesn't flash or ring when a job finishes..?!
Comment 1 Igor editbugs 2019-09-07 15:29:04 CEST
Hi Simon,

In order for the visual bell to work, there should be a command issued - `echo -e '\a'`. If you run `sleep 5 && echo -e '\a'` in the terminal and switch to another window, the terminal window should start blinking in 5 seconds. You can use the same technique for long running jobs.

xfce4-terminal has another feature that might help: tab activity indicator. If your job prints something once it's done, the tab it was running in will change its label color so you'll know something's happened.
Comment 2 Simon 'The Sorcerer' 2019-09-08 15:51:32 CEST
Ahh thx with '\a' it is indeed working, but it would be nice if one could enable this automatically when a job finishes without having to add '\a' manually, probably with a checkbox in context menu. This is probably a Feature request then, rather than a bug. The terminal could see if there is a command prompt or if all child processes finished and then automatically notify.
Comment 3 Egmont Koblinger 2019-09-08 18:37:14 CEST
There are two fundamentally different approaches to notification. One is automatic based on activity (or lack thereof), and is implemented in xfce4-terminal.

The other approach is notifications on certain events, such as when a command completes. The problem with this is making it automatic. The terminal emulator cannot do it because it doesn't "understand" what's happening inside, e.g. doesn't know what's a "shell prompt" and hence doesn't know when a process launched from the shell completes. And bash cannot be configured to automatically emit certain escape sequences at such events, we failed to convince bash's maintainer to add this feature. I'm not aware of the state of other shells. See the gnome-terminal counterpart issue at https://bugzilla.gnome.org/show_bug.cgi?id=711059 for a detailed analysis of the problem.
Comment 4 Simon 'The Sorcerer' 2019-09-08 23:02:27 CEST
Thanks for the clarification, I found a workaround by putting \a into the command line prompt using my .zshrc/.bashrc:
export PS1=$'\a'"$PS1"

The problem with that is that of course that the user has to manually add this and also that it beeps for every executed command which gets annoying pretty fast it would be great to have the acoustic notification only enabled for specific tabs via a checkbox in right-click context menu..
Comment 5 Simon 'The Sorcerer' 2019-09-13 20:36:18 CEST
Here more specific patches for the prompts:
.bashrc:
if [[ "$TERM" =~ "xterm*" ]]; then
 export PS1=$'\001'$'\a'$'\002'"$PS1"
fi

.zshrc
if [[ "$TERM" =~ "xterm*" ]]; then
 export PS1=%{$'\a'%}"$PS1"
fi

Still xterm* is not really specific for xfce4-terminal, is there some better way to recognize xfce4-terminal from inside the shell?
I also thought over this acoustiv bell, it would already help if the acoustic bell was just enabled if the notifying tab doesn't have focus!
Comment 6 Git Bot editbugs 2020-05-24 23:45:39 CEST
-- GitLab Migration Automatic Message --

This bug has been migrated to xfce.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.xfce.org/apps/xfce4-terminal/-/issues/39.

Please create an account or use an existing account on one of our supported OAuth providers. 

If you want to fork to submit patches and merge requests please continue reading here: https://docs.xfce.org/contribute/dev/git/start#gitlab_forks_and_merge_requests

Also feel free to reach out to us on the mailing list https://mail.xfce.org/mailman/listinfo/xfce4-dev

Bug #15939

Reported by:
Simon 'The Sorcerer'
Reported on: 2019-09-07
Last modified on: 2020-05-24

People

CC List:
1 user

Version

Version:
unspecified

Attachments

Additional information