This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Get notified when Konsole returns to Command Prompt?

Tags: konsole konsole konsole
(comma "," separated)
User avatar
Kubuntiac
Registered Member
Posts
786
Karma
2
Quick question...

Does anyone know a way of getting a notification when a command line job finishes and returns to the command prompt?

I know there's "monitor for silence" but that often seems to trigger just because there hasn't been any changes on the command line for a few seconds. I don't want a notification until the command prompt appears (ie the job is done!)
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
If the command does not output anything, you may wish to use Monitor for activity. Otherwise I do not think it is possible, unless you enable notifications on Bell, and append a command to the existing command that triggers the bell.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
jamesshau
Registered Member
Posts
2
Karma
0
OS
I also wanted to get notification upon shell prompt. I never found useful the notification for activity/silence.

As suggested, I now used the notification for bell w/ a follow-up command generating the bell. This till has one drawback that if the terminal getting the bell is the one having the focus in konsole, even if konsole itself does not have the focus (e.g. I turned to edit in vim ...), then the bell icon disappeared right away.

When it really matters, I used a command that would pop up a window (somehow "Display a message box" in "Configure notifications" does not work for me.)

The simplest command to pop up a window:

xterm -e "echo 'Done. Press Ctrl-D to continue.'; cat"

To generate a bell,

Originally I just did

echo "\a"

But somehow it does not work when I was in a svn view (echo would just literally output two characters \ and a), so I built a simple c program to do it:

#include <stdio.h>
int main() { printf("\a"); return 0; }
jamesshau
Registered Member
Posts
2
Karma
0
OS
Actually

perl -e 'print "\a"'

also works to generate the bell; should be better than a c binary from scripting point of view.
User avatar
Hans
Administrator
Posts
3304
Karma
24
OS
jamesshau wrote:The simplest command to pop up a window:

xterm -e "echo 'Done. Press Ctrl-D to continue.'; cat"


You can also use kdialog to show a dialog, see kdialog --help. I like kdialog --passivepopup, but I don't know how to show it without a timeout (i.e., don't hide without user interaction).


Problem solved? Please click on "Accept this answer" below the post with the best answer to mark your topic as solved.

10 things you might want to do in KDE | Open menu with Super key | Mouse shortcuts
User avatar
flying sheep
Registered Member
Posts
56
Karma
0
OS
just found this, thanks.

but by now the invocation is
Code: Select all
kdialog --passivepopup <message> <timeout>

so you can indeed use it:
Code: Select all
do-something-lengthy; kdialog --passivepopup Done 99999999999



/e: big numbers for timeout don’t seem to be supported :(

time to write this functionality in a quick PyQt script :)
(don’t wait for it, though, i’ll do it whenever i have to learn how to use notifications)


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot], Yahoo [Bot]