uNote is very simple and flexible standalone GUI notification utility.
It is not affiliated with any of window managers.
It provides network interface to accept messages.
It makes it possible to receive messages from different scripts,
even from other hosts. And it makes very easy to raise
notifications from routines like cron and at without
care about $DISPLAY and Xauth.
uNote is written on Tcl/Tk and does not require
any additional libraries.
uNote supports multiply windows and can display two types of messages:
text and progress bar.
uNote is one file (script). Just run it.
To run it automatically add it to ~/.xinitrc.
Simplest:
echo '|Hello, world!' | nc localhost 7779Big red label at specified place, displayed for 10 seconds:
echo 'geometry=+10+10,fg=f00,bg=ff0,size=24,padx=120,duration=10|Hello, world!' | nc localhost 7779Green 80% bar:
echo 'type=bar,geometry=+10+10,percent=80,width=200,height=10,duration=10,fg=0f0,bg=000,bd=090|' | nc localhost 7779Message consists of two parts, separated by pipe ("|"). First (left) part contains options, second (right) part is a message itself.
So, simplest text message is "|OK":
echo '|OK' | nc localhost 7779Params are:
type:textorbar(defaulttext)geometry: position in X-format like+0+0,-10-0etc.duration: secondsservice: name of queues (see below)fg: foreground colorbg: background colorbd: border colortc: percent text color (for progress bar)padx: horizontal paddingpady: vertical paddingsize: font sizefamily: font family likeDroid Serif(commandfc-list : familyshow all font families on your X)bold: bold flagjustify: text justification (left, right, center)percent: percents (for progress bar)
For every unique geometry value raise its own window.
Every window has its own message queue and displays only one message form top of queue.
New message is appended to queue, and replaces existence
with same value of service. If service not specified, it
will be generated by random number generator.
#!/usr/bin/perl
use strict;
use warnings;
use Socket;
my $message = 'DONE!';
my $host = 'localhost';
my $port = 7779;
socket(SOCK, PF_INET, SOCK_STREAM, (getprotobyname('tcp'))[2]);
connect(SOCK, sockaddr_in($port, inet_aton($host)));
send(
SOCK,
'geometry=+0+10,bg=99f,fg=000,size=24,padx=12,duration=10,family=Ubuntu Condensed|' .
$message,
0
);#!/usr/bin/python
import socket
HOST = 'localhost'
PORT = 7779
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
s.sendall(b'|Hello, world')
s.close()Script to send message with two possible color schemes.
#!/bin/sh
sets='service=remote,duration=20,bg=#224,fg=#99f,size=40,padx=30,family=Ubuntu,geometry=+700-0'
if test "a$#" = 'a2'
then
if test "a$1" = 'a--small-green'
then
sets='service=remote,duration=20,bg=#222,fg=#0f0,size=14,padx=10,family=Ubuntu,geometry=+200+0'
else
echo "Ignore option $1"
fi
shift
fi
mess=$1
if test -z "$mess"
then
mess="`uname -n`: Complete"
fi
echo -n "$sets|$mess" |
nc localhost 7779You can add to your ~/.ssh/config:
RemoteForward 7779 localhost:7779