https://github.com/michurin/unote
Simple standalone GUI notification utility with simple network API
https://github.com/michurin/unote
desktop gui network notification remote-control
Last synced: 5 months ago
JSON representation
Simple standalone GUI notification utility with simple network API
- Host: GitHub
- URL: https://github.com/michurin/unote
- Owner: michurin
- Created: 2016-01-07T08:10:12.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2025-09-14T06:09:39.000Z (9 months ago)
- Last Synced: 2025-09-14T08:17:46.345Z (9 months ago)
- Topics: desktop, gui, network, notification, remote-control
- Language: Tcl
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
What is uNote
=============
`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*.
How to run
==========
`uNote` is one file (script). Just run it.
To run it automatically add it to `~/.xinitrc`.
How to send message
===================
Simplest:
```sh
echo '|Hello, world!' | nc localhost 7779
```
Big red label at specified place, displayed for 10 seconds:
```sh
echo 'geometry=+10+10,fg=f00,bg=ff0,size=24,padx=120,duration=10|Hello, world!' | nc localhost 7779
```
Green 80% bar:
```sh
echo 'type=bar,geometry=+10+10,percent=80,width=200,height=10,duration=10,fg=0f0,bg=000,bd=090|' | nc localhost 7779
```
Message structure and params
============================
Message structure
-----------------
Message 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`":
```sh
echo '|OK' | nc localhost 7779
```
Params overview
---------------
Params are:
* `type`: `text` or `bar` (default `text`)
* `geometry`: position in X-format like `+0+0`, `-10-0` etc.
* `duration`: seconds
* `service`: name of queues (see below)
* `fg`: foreground color
* `bg`: background color
* `bd`: border color
* `tc`: percent text color (for progress bar)
* `padx`: horizontal padding
* `pady`: vertical padding
* `size`: font size
* `family`: font family like `Droid Serif` (command `fc-list : family` show all font families on your X)
* `bold`: bold flag
* `justify`: text justification (left, right, center)
* `percent`: percents (for progress bar)
Windows and queues (`service`)
------------------------------
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.
Code snippets
=============
Call from Perl
--------------
```perl
#!/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
);
```
Call from Python (v2 and v3)
----------------------------
```python
#!/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()
```
Complete useful sh example
--------------------------
Script to send message with two possible color schemes.
```sh
#!/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 7779
```
Create ssh tunnel
-----------------
You can add to your `~/.ssh/config`:
```sshconfig
RemoteForward 7779 localhost:7779
```