New issue
Advanced search Search tips

Issue 735780 link

Starred by 0 users

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Feature



Sign in to add a comment

hterm: support arbitrary notifications from shell scripts

Project Member Reported by vapier@chromium.org, Jun 22 2017

Issue description

there's not a lot of prior art that i can find here.  most terminals don't support this at all and instead expect people to use tools like `notify-send` or `kdialog` or `dbus-send` to trigger native reaction.

i have found some that do though.

iTerm2:
- https://www.iterm2.com/faq.html
- \e]9;Growl Notification\007

rxvt-unicode:
- http://pod.tst.eu/http://cvs.schmorp.de/rxvt-unicode/doc/rxvt.7.pod
- not directly supported, but has a plugin model where OSC 777 can trigger any module, and there's a standard "notify" module there.
- \e]777;notify;<title>;<body>\a

terminology:
- supports the rxvt-unicode method (although the code says "xterm", they really meant "rxvt-unicode")
- https://git.enlightenment.org/apps/terminology.git/tree/src/bin/termptyesc.c?h=v1.0.0#n1297

i'm inclined to implement the 777;notify approach since it has both title & message support.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Jun 29 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/apps/libapps/+/a5fb83c190aa9d74f4a9bca233dac6be2664e9e9

commit a5fb83c190aa9d74f4a9bca233dac6be2664e9e9
Author: Mike Frysinger <vapier@chromium.org>
Date: Thu Jun 29 21:11:27 2017

hterm: initial support for custom notifications

First refactor the existing bell notification code to expose
a simple API for callers.  This creates hterm.notify and some
core tests.

We support iTerm2's simple growl notifications (OSC 9), and
rxvt-unicode's notify module (OSC 777) for title/body.

BUG= chromium:735780 

Change-Id: Ie704634938fe9966fb1adbca9035fd7d6bd15acf
Reviewed-on: https://chromium-review.googlesource.com/551336
Reviewed-by: Brandon Gilmore <varz@google.com>
Tested-by: Mike Frysinger <vapier@chromium.org>

[modify] https://crrev.com/a5fb83c190aa9d74f4a9bca233dac6be2664e9e9/hterm/html/hterm_test.html
[modify] https://crrev.com/a5fb83c190aa9d74f4a9bca233dac6be2664e9e9/hterm/js/hterm_mock_notification.js
[modify] https://crrev.com/a5fb83c190aa9d74f4a9bca233dac6be2664e9e9/hterm/js/hterm_terminal_tests.js
[modify] https://crrev.com/a5fb83c190aa9d74f4a9bca233dac6be2664e9e9/hterm/js/hterm.js
[add] https://crrev.com/a5fb83c190aa9d74f4a9bca233dac6be2664e9e9/hterm/js/hterm_tests.js
[modify] https://crrev.com/a5fb83c190aa9d74f4a9bca233dac6be2664e9e9/hterm/doc/ControlSequences.md
[modify] https://crrev.com/a5fb83c190aa9d74f4a9bca233dac6be2664e9e9/hterm/js/hterm_terminal.js
[modify] https://crrev.com/a5fb83c190aa9d74f4a9bca233dac6be2664e9e9/hterm/js/hterm_vt_tests.js
[modify] https://crrev.com/a5fb83c190aa9d74f4a9bca233dac6be2664e9e9/hterm/js/hterm_vt.js

Project Member

Comment 2 by bugdroid1@chromium.org, Jun 29 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/apps/libapps/+/913227a00f675a525f2d35bfc6d4d0712b555420

commit 913227a00f675a525f2d35bfc6d4d0712b555420
Author: Mike Frysinger <vapier@chromium.org>
Date: Thu Jun 29 21:12:14 2017

hterm: add a notification icon

Most notifications by default have a blank space.  Fill it out with our
default hterm icon -- an angry terminal.

BUG= chromium:735780 

Change-Id: I2c126fca3d18adf67e3521c1a722c3cc20b7a7dd
Reviewed-on: https://chromium-review.googlesource.com/551337
Reviewed-by: Brandon Gilmore <varz@google.com>
Tested-by: Mike Frysinger <vapier@chromium.org>

[add] https://crrev.com/913227a00f675a525f2d35bfc6d4d0712b555420/hterm/images/icon-96.png
[modify] https://crrev.com/913227a00f675a525f2d35bfc6d4d0712b555420/hterm/concat/hterm_resources.concat
[modify] https://crrev.com/913227a00f675a525f2d35bfc6d4d0712b555420/hterm/js/hterm.js

Comment 3 by vapier@chromium.org, Jun 29 2017

Status: Fi (was: Available)
this is in hterm-1.66+ and nassh-0.8.36.6+

Comment 4 by vapier@chromium.org, Jun 29 2017

Owner: vapier@chromium.org
Status: Fixed (was: fi)

Comment 5 by vapier@chromium.org, Jun 29 2017

for posterity, this is documented here:
https://chromium.googlesource.com/apps/libapps/+/master/hterm/doc/ControlSequences.md#OSC

example of the formats:
  printf '\x1b]9;title\a'
  printf '\x1b]777;notify;title;body\a'

Project Member

Comment 6 by bugdroid1@chromium.org, Aug 4 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/apps/libapps/+/10a9b1b5eaf4003e5d48039bc3a277afd4b94c6b

commit 10a9b1b5eaf4003e5d48039bc3a277afd4b94c6b
Author: Mike Frysinger <vapier@chromium.org>
Date: Fri Aug 04 20:37:09 2017

nassh: FAQ: document screen/tmux pass thru

Should help people use hterm specific sequences like notifications.
Throw in a helper notify script for fun, and update the osc52 one
to support tmux.

BUG= chromium:735780 

Change-Id: Ia59b049776a4faa81ec08f3c2f71fcddacb1241f
Reviewed-on: https://chromium-review.googlesource.com/601549
Reviewed-by: Ruslan Osipov <ruslano@google.com>
Reviewed-by: Brandon Gilmore <varz@google.com>
Tested-by: Mike Frysinger <vapier@chromium.org>

[modify] https://crrev.com/10a9b1b5eaf4003e5d48039bc3a277afd4b94c6b/hterm/etc/osc52.sh
[modify] https://crrev.com/10a9b1b5eaf4003e5d48039bc3a277afd4b94c6b/nassh/doc/FAQ.md
[add] https://crrev.com/10a9b1b5eaf4003e5d48039bc3a277afd4b94c6b/hterm/etc/hterm-notify.sh

Sign in to add a comment