GNOME Terminal job noticications

Anyone know how to get GNOME Terminal job notifications as described at https://fedoramagazine.org/terminal-job-notifications-in-fedora-22-workstation/ in LEAP 42.2?

The closest I can find to any information about how it’s done is someone saying it’s built in to GNOME Terminal, but if that’s the case then it ought to be available on every distro with GNOME 3.16 or higher and it doesn’t seem to be. Google searches find people asking about this for Ubuntu too, but no useful answers.

On Sat 28 Jan 2017 10:36:02 PM CST, arizonagroovejet wrote:

Anyone know how to get GNOME Terminal job notifications as described at
Terminal job notifications in Fedora 22 Workstation - Fedora Magazine in LEAP 42.2?

The closest I can find to any information about how it’s done is someone
saying it’s built in to GNOME Terminal, but if that’s the case then it
ought to be available on every distro with GNOME 3.16 or higher and it
doesn’t seem to be. Google searches find people asking about this for
Ubuntu too, but no useful answers.

Hi
Just edit ~/.bashrc and add;


PROMPT_COMMAND='notify-send --icon=/usr/share/icons/Adwaita/256x256/apps/utilities-terminal.png "Task finished" "$(history | sed -n "\$s/^  [0-9]\+  //p")"'

Restart your gnome-terminal and run say sleep 5 as a test.


Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
openSUSE Leap 42.1|GNOME 3.16.2|4.1.36-44-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!

Why is the url in your quoted version of my message different to the url I posted?

What that achieves is like GNOME Terminal job notifications in Fedora in that it involves notifications, but that’s it. GNOME Terminal job notifications appear when a command in a non-focused tab/window exits. What your solution does it produce a notification every time I hit enter at a command prompt. It becomes immensely annoying after about five seconds.

The notification only ever says “Task finished”. If I change

sed -n "\$s/^  [0-9]\+  //p"

to

sed -n "\$s/^ [0-9]\+  //p"

Then the notification also contains the last command I ran, which means this

mike@continuity:~>ls >/dev/null
mike@continuity:~>
mike@continuity:~>
mike@continuity:~>
mike@continuity:~>

Results in five notifications that have “ls >dev/null” in the body which is wrong as well as pointless.

On Sun 29 Jan 2017 09:56:02 PM CST, arizonagroovejet wrote:

Why is the url in your quoted version of my message different to the url
I posted?

malcolmlewis;2810339 Wrote:
> Hi
> Just edit ~/.bashrc and add;
> >
Code:

> >
> PROMPT_COMMAND=‘notify-send
–icon=/usr/share/icons/Adwaita/256x256/apps/utilities-terminal.png
“Task finished” “$(history | sed -n “$s/^ [0-9]+ //p”)”’ >

> >
> Restart your gnome-terminal and run say sleep 5 as a test.
>
What that achieves is like GNOME Terminal job notifications in Fedora in
that it involves notifications, but that’s it. GNOME Terminal job
notifications appear when a command in a non-focused tab/window exits.
What your solution does it produce a notification every time I hit enter
at a command prompt. It becomes immensely annoying after about five
seconds.

The notification only ever says “Task finished”. If I change

Code:

sed -n “$s/^ [0-9]+ //p”

to

Code:

sed -n “$s/^ [0-9]+ //p”

Then the notification also contains the last command I ran, which means
this

Code:

mike@continuity:~>ls >/dev/null
mike@continuity:~>
mike@continuity:~>
mike@continuity:~>
mike@continuity:~>

Results in five notifications that have “ls >dev/null” in the body which
is wrong as well as pointless.

Hi
It’s not different, your link is just converted to a tinyURL via
vBulletin…

This one works better…

I’ve hunted around on my Leap 42.1 install but can’t see what they are
talking about with the terminal notifications…

Do you have a specific package in mind?


Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
openSUSE Leap 42.1|GNOME 3.16.2|4.1.36-44-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!

Why does vBulletin replace urls with a layer of redirection via a third party service when they’re quoted? Seems like bizarrely pointless unhelpful behaviour.

Meh. I already know I could stick

;notify-send "done" 

or something like that after a command. The notifications in Fedora don’t require any effort to use, they just automatically happen when it’s useful for them to happen, as if by sufficiently advanced technology.

As far as I can tell there is no package in Fedora that provides the behaviour, it’s built in to either gnome-terminal or vte or possibly both. On Fedora /etc/profile.d/vte.sh contains this

__vte_prompt_command() {
  local command=$(HISTTIMEFORMAT= history 1 | sed 's/^ *[0-9]\+ *//')
  command="${command//;/ }"
  local pwd='~'
   "$PWD" != "$HOME" ] && pwd=${PWD/#$HOME\//\~\/}
  printf "\033]777;notify;Command completed;%s\007\033]0;%s@%s:%s\007%s" "${command}" "${USER}" "${HOSTNAME%%.*}" "${pwd}" "$(__vte_osc7)"
}

Which is different to the equivalent function in openSUSE Leap 42.2. But using the Fedora version of the function in openSUSE doesn’t result in notifications. There’s some relevant discussions linked from

I’ve pretty much come to the conclusion that it’s a Fedora specific thing they’ve hacked in which hasn’t gone upstream so that other distros can benefit. Which is very disappointing. :frowning: I’ve looked at src-rpm for Fedora 25 but can’t find relevant bits.

On Mon 30 Jan 2017 04:46:01 PM CST, arizonagroovejet wrote:

malcolmlewis;2810422 Wrote:
> Hi
> It’s not different, your link is just converted to a tinyURL via
> vBulletin…
>
Why does vBulletin replace urls with a layer of redirection via a third
party service when they’re quoted? Seems like bizarrely pointless
unhelpful behaviour.

malcolmlewis;2810422 Wrote:
>
> This one works better…
> Get Notified When A Job You Run In A Terminal Is Done, Using NotifyOSD [Ubuntu] ~ Web Upd8: Ubuntu / Linux blog
>
Meh. I already know I could stick

Code:

;notify-send “done”

or something like that after a command. The notifications in Fedora
don’t require any effort to use, they just automatically happen when
it’s useful for them to happen, as if by sufficiently advanced
technology.

malcolmlewis;2810422 Wrote:
>
> I’ve hunted around on my Leap 42.1 install but can’t see what they are
> talking about with the terminal notifications…
>
> Do you have a specific package in mind?
>
As far as I can tell there is no package in Fedora that provides the
behaviour, it’s built in to either gnome-terminal or vte or possibly
both. On Fedora /etc/profile.d/vte.sh contains this

Code:

__vte_prompt_command() {
local command=$(HISTTIMEFORMAT= history 1 | sed 's/^ *[0-9]+ //‘)
command=“${command//;/ }”
local pwd=’~’
“$PWD” != “$HOME” ] && pwd=${PWD/#$HOME//~/}
printf “\033]777;notify;Command
completed;%s\007\033]0;%s@%s:%s\007%s” “${command}” “${USER}”
"${HOSTNAME%%.
}" “${pwd}” “$(__vte_osc7)” } --------------------

Which is different to the equivalent function in openSUSE Leap 42.2. But
using the Fedora version of the function in openSUSE doesn’t result in
notifications. There’s some relevant discussions linked from
Google Workspace Updates: New community features for Google Chat and an update on Currents
I’ve pretty much come to the conclusion that it’s a Fedora specific
thing they’ve hacked in which hasn’t gone upstream so that other distros
can benefit. Which is very disappointing. :frowning: I’ve looked at src-rpm for
Fedora 25 but can’t find relevant bits.

Hi
Ok, found the bug report…
https://bugzilla.gnome.org/show_bug.cgi?id=711059


Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
openSUSE Leap 42.1|GNOME 3.16.2|4.1.36-44-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!