• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

LICENSEH A D01-Dec-20201 KiB2217

MakefileH A D01-Dec-2020550 3020

README.mdH A D01-Dec-20204.2 KiB11675

config.hH A D01-Dec-20201,007 3418

config.mkH A D01-Dec-2020557 2914

xnotify.1H A D01-Dec-20207.7 KiB309308

xnotify.cH A D01-Dec-202030.7 KiB1,2271,004

xnotify.hH A D01-Dec-20201.9 KiB11381

README.md

1<p align="center">
2  <img src="https://user-images.githubusercontent.com/63266536/93797439-c65d0680-fc2b-11ea-80e3-10bbd6f65dcb.gif", title="demo"/>
3</p>
4
5# XNotify
6
7XNotify displays a notification on the screen.
8XNotify receives a notification specification in stdin and shows a
9notification for the user on the screen.
10
11See the [manual](https://github.com/phillbush/xnotify/wiki) for more information on how xnotify works.
12
13
14## Features
15
16XNotify comes with the following features:
17
18* xnotify receives notifications from stdin.
19  You can use a fifo to echo notifications on the fly like
20
21  `echo Hello World > /path/to/xnotify.fifo`
22
23* xnotify queue notifications and display them one above the other.
24
25* Image support, just prefix the notification string with `IMG:/path/to/the/file.png` and a tab.
26
27* Multiple monitor support.  You can set the monitor with the `-m` option.
28
29* Support for fallback fonts (you can set more than one fonts, that will be tried in order).
30
31* X resources support (you don't need to recompile Xnotify for configuring it).
32
33
34## Files
35
36The files are:
37
38* `./README`:           This file.
39* `./Makefile`:         The makefile.
40* `./config.h`:         The hardcoded default configuration for XNotify.
41* `./config.mk`:        The setup for the makefile.
42* `./xnotify.{c,h}`:    The source code of XNotify.
43
44
45## Installation
46
47First, edit `./config.mk` to match your local setup.
48
49In order to build XNotify you need the `Imlib2`, `Xlib` and `Xft` header files.
50The default configuration for XNotify is specified in the file `config.h`,
51you can edit it, but most configuration can be changed at runtime via
52X resources and via command-line options.
53Enter the following command to build XNotify.
54This command creates the binary file `./xnotify`.
55
56	make
57
58By default, XNotify is installed into the `/usr/local` prefix.  Enter the
59following command to install XNotify (if necessary as root).  This command
60installs the binary file `./xnotify` into the `${PREFIX}/bin/` directory, and
61the manual file `./xnotify.1` into `${MANPREFIX}/man1/` directory.
62
63	make install
64
65
66## Running XNotify
67
68XNotify receives as input one line per notification.
69Each line is made out of a notification title and a notification body separated by any number of tabs.
70Lines without a title are ignored.
71
72The following is an example of how to run XNotify
73
74	$ xnotify -m 10 -G NE -g -10+10 -s 15
75
76This line means: read notifications from stdin, display
77the notifications on the north east (`-G NE`) of the monitor 0 (`-m 0`),
78that is, on the upper right corner of the first monitor.  The
79notifications should be placed 10 pixels to the left and 10 pixels
80down (thus creating a 10 pixel gap with the upper right corner).
81Each notification stay alive for 15 seconds.
82
83To create a named pipe for XNotify, you can place the following in the beginning of your `~/.xinitrc`.
84This will create a named pipe unique to your current X display in your home directory at `~/.cache`.
85Then, it will open xnotify in the background, reading from this named pipe.
86
87	XNOTIFY_FIFO="$HOME/.cache/xnotify$DISPLAY.fifo"
88	export XNOTIFY_FIFO
89	rm -f $XNOTIFY_FIFO
90	mkfifo $XNOTIFY_FIFO
91	xnotify 0<>$XNOTIFY_FIFO
92
93Note that the first two lines (the line setting the environment variable and the line exporting it)
94should be at the beginning of your `~/.xinitrc`, so other programs you invoke are aware of this variable.
95
96To create a notification with a image, input to XNotify a line beginning
97with `IMG:/path/to/file.png` followed by a tab.  For example:
98
99	$ printf 'IMG:/path/to/file.png\tThis is a notification\n' > $XNOTIFY_FIFO
100
101To read dbus notifications from stdin, you'll need [tiramisu](https://github.com/Sweets/tiramisu).
102You'll also need [jq](https://stedolan.github.io/jq/) in order to parse tiramisu's JSON output.
103Then add the following line to your `.xinitrc`, after the line calling xnotify.
104
105	$ tiramisu -j | jq --raw-output --unbuffered '.summary + "\t" + .body' > $XNOTIFY_FIFO &
106
107To use a different size other than the default for the notifications,
108run `xnotify` with the `-g` option set to the notification size in
109`WIDTHxHEIGHT`.  For example:
110
111	$ xnotify -g 300x80
112
113The argument for the `-g` option has the form `[WIDTHxHEIGHT][{+-}XPOS{+-}YPOS]`.
114Parts between square brackets are optional.
115`{+-}` means to chose either `+` or `-`.
116