Xfce Forum

Sub domains
 

You are not logged in.

#1 2021-05-12 13:48:37

orschiro
Member
Registered: 2017-11-30
Posts: 65

Notifications for long completed terminal commands?

Hey guys!

Let's say you put a "sleep 2m" into the terminal.

Does the 4.16 Xfce Terminal come with a feature to send a notification once the command has been completed?

Offline

#2 2021-05-19 16:46:50

desipher
Member
Registered: 2021-05-10
Posts: 25

Re: Notifications for long completed terminal commands?

I don't think there is an inbuilt feature for that. I have had some terminal notify me of task completion but I don't remember which one they were. Maybe it was konsole? IDK.

But what you can do is something like this...

~$ command 1 && command 2

So command 2 will be automatically executed once command 1 is completed. Now you can just set command 2 to play a sound file or something.

Use "&&" or ";" both should work.

Last edited by desipher (2021-05-19 16:48:00)

Offline

#3 2021-05-19 17:40:47

orschiro
Member
Registered: 2017-11-30
Posts: 65

Re: Notifications for long completed terminal commands?

Thanks! Meanwhile I found this [1] which is exactly what I was looking for. smile

[1] https://ntfy.readthedocs.io/en/latest/

Offline

#4 2021-05-20 09:54:27

desipher
Member
Registered: 2021-05-10
Posts: 25

Re: Notifications for long completed terminal commands?

orschiro wrote:

Thanks! Meanwhile I found this [1] which is exactly what I was looking for. smile

[1] https://ntfy.readthedocs.io/en/latest/

I found another thing. It's an inbuilt command called "notify-send" In case the ntfy thing stops working you can still use this one. Also it's really robust. Although it won't send a notification to your phone which is a deal breaker I can understand. But since I was having difficulties installing ntfy, I thought I'd just let you know.

notify-send "Did you tell your loved once today, how much you love them? Go do it."

This will just appear on your desktop as a notification.

Last edited by desipher (2021-05-20 09:57:47)

Offline

#5 2021-05-20 12:45:39

orschiro
Member
Registered: 2017-11-30
Posts: 65

Re: Notifications for long completed terminal commands?

This is good, yes!

However, I just want this built-in for all long commands that take longer than X seconds.

Don't want to always remember to put the notify-send prefix before another command. ;-)

Offline

#6 2021-05-20 16:10:08

desipher
Member
Registered: 2021-05-10
Posts: 25

Re: Notifications for long completed terminal commands?

orschiro wrote:

This is good, yes!

However, I just want this built-in for all long commands that take longer than X seconds.

Don't want to always remember to put the notify-send prefix before another command. ;-)

Yea chief the closest thing to that which I can think of is an alias so you can shorten notify-send to something like ns "done" meaning you will have to type this

ns && whatever_command-you@want

However it is posibble to have a command run before every other command in bash. I don't know how to do it but if you want check this out.
Let me know how it goes.

Offline

Board footer

Powered by FluxBB