sxalert

Simple notification system for X
git clone git://mcdim.xyz/sxalert.git
Log | Files | Refs | README | LICENSE

commit cac1dbd6902deb79e49be24c736e05ddf77e76b4
parent f03dc8913a82e6eea3ea2c6b7e7ea99a7ad0f7e7
Author: Michail Konstantinos Dimopoulos <mk@mcdim.xyz>
Date:   Tue, 13 Oct 2026 04:43:53 +0300

Polish documentation and source headers

Diffstat:
Mconfig.h | 7+++----
Msxalert.1 | 167++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------
Msxalert.c | 9++++-----
Msxalert.h | 6++++++
4 files changed, 145 insertions(+), 44 deletions(-)

diff --git a/config.h b/config.h @@ -1,8 +1,7 @@ -/* Simple X Alert v0.1 - * Simple notification program for X - * GNU GPL v3.0 +/* sxalert - simple notification program for X * - * config.h - configuration file + * Copyright (C) 2026 Michail Konstantinos Dimopoulos + * License: GPL-3.0-or-later (see LICENSE) */ #include "sxalert.h" diff --git a/sxalert.1 b/sxalert.1 @@ -1,60 +1,157 @@ .\" Manpage for sxalert -.TH man 8 "19 Sept 2026" "0.2" "sxalert manual page" +.TH man 1 "13 Oct 2026" "1.0" "sxalert manual page" .SH NAME sxalert \- Simple X Alert + .SH SYNOPSIS -sxalert [OPTIONS] "First line" "Second line" "Third line" +.B sxalert +.RB [ \-s ] +.RB [ \-t +.IR color ] +.RB [ \-g +.IR color ] +.RB [ \-r +.IR color ] +.RB [ \-b +.IR width ] +.RB [ \-d +.IR duration ] +.RI [ line " ...]" +.br +.B sxalert \-v +.br +.B sxalert \-h + .SH DESCRIPTION -sxalert will draw text as a notification for X +.B sxalert +displays text notifications for X. It accepts standard input, +command-line arguments, or both, appending the latter to the former. +Mouse interactions produce distinct exit statuses, allowing sxalert +to be used in shell scripts. It allows for runtime visual +customizability through command-line arguments. .SH OPTIONS --t text color in hex +.TP +.B -s +Read from stdin. Command line arguments will be appended. --g background color in hex +.TP +.BI "-t " color +Set the text color in hexadecimal. Six consecutive digits without prefix. --r border color in hex +.TP +.BI "-g " color +Set the background color. --b border width in pixels +.TP +.BI "-r " color +Set the border color. --d duration in milliseconds - for values below or equal to 0 the notification will run indefinitely +.TP +.BI "-b " width +Set the border width in pixels. --s read from stdin (command line arguments will be appended) +.TP +.BI "-d " duration +Set the duration in milliseconds. Will run indefinitely for values less than, or equal to, zero. --h print help panel & exit +.TP +.B -h +Print help panel & exit. --v print version & exit +.TP +.B -v +Print version & exit. .SH EXIT CODES -0 - Left click on the notification window -1 - Midde click on the notification window -2 - Right click on the notification window -3 - Time out - -.SH EXAMPLES - -This will print the string "Updates available": -sxalert "Updates avalailable" +.TP +.B 0 +Left click on the notification window. -The following will also print "Updates available" but will specify text -color to be red, background to be black and border width to be 0: +.TP +.B 1 +Midde click on the notification window. -sxlaert -t 0xff0000 -g 0x000000 -b 0 "Updates available" +.TP +.B 2 +Right click on the notification window. -These will overwrite the defaults specified in config.h +.TP +.B 3 +Time out. -The following will print "New mail" and echo "OK" to stdout if the user -left clicks on the notification window: - -sxalert "New mail" && echo "OK" +.SH EXAMPLES -.SH AUTHOR +Display a simple notification: +.PP +.RS +.nf +sxalert "Updates avalailable" +.fi +.RE + +Display a notification with red text, black background, no border: +.PP +.RS +.nf +sxalert -t 0xff0000 -g 0x000000 -b 0 "Updates available" +.fi +.RE + +These options override the defaults in config.h. +.PP + +Confirmation dialoge with a right click, dismissed otherwise: +.PP +.RS +.nf +sxalert "Proceed with backup?" && backup.sh +.fi +.RE + +Launch neomutt in st when the notification is accepted; otherwise display "Ignored": +.PP +.RS +.nf +sxalert "New mail!" && nohup st -e neomutt || sxalert "Ignored" +.fi +.RE + +Display a preformatted text file: +.PP +.RS +.nf +sxalert -s < banner.txt +.fi +.RE + +Display stdin and append a timestamp: +.PP +.RS +.nf +make test | tail | sxalert -s "$(date)" +.fi +.RE + +.SH COLOPHON +.TP +.B Author Michail Konstantinos Dimopoulos <mk@mcdim.xyz> - -https://mcdim.xyz - -.SH LICENSE -GNU General Public License 3.0 (GPL-3.0) +.TP +.B Copyright +\(co 2023,2026 Michail Konstantinos Dimopoulos +.TP +.B License +GNU General Public License 3.0 or later (GPL-3.0-or-later) + +.TP +.B Patches +Send patches to <hackers@mcdim.xyz> + +.SH SEE ALSO +.BR herbe (1), +.BR xmessage (1), +.BR notify-send (1) diff --git a/sxalert.c b/sxalert.c @@ -1,8 +1,7 @@ -/* Simple X Alert v0.1 - * Simple notification program for X - * GNU GPL v3.0+ +/* sxalert - simple notification program for X * - * sxalert.c - main program + * Copyright (C) 2026 Michail Konstantinos Dimopoulos + * License: GPL-3.0-or-later (see LICENSE) */ #include <stdlib.h> @@ -18,7 +17,7 @@ #include "config.h" -#define VERSION "v0.2" +#define VERSION "v1.0" static inline void die(const char *msg, int code) diff --git a/sxalert.h b/sxalert.h @@ -1,3 +1,9 @@ +/* sxalert - simple notification program for X + * + * Copyright (C) 2026 Michail Konstantinos Dimopoulos + * License: GPL-3.0-or-later (see LICENSE) + */ + #ifndef SXALERT_H #define SXALERT_H