commit 30270f25a45d7db88bf8ee6868fbf783d6a8d94d
parent 20bfa34182ff7b13e7124600c290d40d9387b2ff
Author: Michael Constantine Dimopoulos <mk@mcdim.xyz>
Date:   Sat,  4 Nov 2023 17:54:38 +0000
Added readme, duration as argument & updated help panel
Diffstat:
3 files changed, 53 insertions(+), 9 deletions(-)
diff --git a/README.md b/README.md
@@ -0,0 +1,36 @@
+# Simple X Alert 
+
+Simple notification system for X that works without a daemon. This is mainly for personal use, but I'll be glad to support whoever else wants to use it. Currently in development.
+
+## Features
++ Freetype scalable fonts
++ UTF-8 support
++ Configurable & scriptable
+
+## Dependencies
+To build simple X alert, you'll need Xlib and Xft.
+
+## Build
+In order to install, execute the following commands:
+```
+$ git clone https://github.com/MichaelDim02/sXalert.git && cd sXalert
+$ sudo make sxalert
+```
+
+## Usage
+You can simply run the tool with each argument being a line of text
+```
+$ ./sxalert "First line" "Second line"
+```
+You can also set color and border width
+```
+$ ./sxalert -b 5 -t FFFFFF -g 000000 -r FFFFFF "First line" "Second line"
+```
+These will overwrite the defaults written in `config.h`
+
+## TODOs:
++ Dynamic screen positioning
++ Width based on text
++ Exit by event (perhaps as a path)
++ Titles (perhaps as a patch)
++ (?) optional daemon for positinioning
diff --git a/config.h b/config.h
@@ -1,4 +1,9 @@
-/* simpleXalert Configuration */
+/* Simple X Alert v0.1
+ * Simple notification program for X
+ * GNU GPL v3.0
+ *
+ * config.h - configuration file
+ */
 
 #define BUFFER 2054
 
diff --git a/sxalert.c b/sxalert.c
@@ -1,4 +1,4 @@
-/* simpleXalert v0.1
+/* Simple X Alert v0.1
  * Simple notification program for X
  * GNU GPL v3.0
  *
@@ -40,9 +40,12 @@ help(void) /* TODO: update */
 {
 	printf("sXalert %s\n", VERSION);
 	printf("Alert utility for X\n\n");
-	printf("	-c color in hex:hex:hex format\n");
-	printf("	-s time in seconds\n");
+	printf("	-t text hex color (eg FFFFFF)\n");
+	printf("	-g background hex color\n");
+	printf("	-r border hex color\n");
 	printf("	-b border width in pixels\n");
+	printf("	-d duration in milliseconds\n");
+	printf("	-v print version & exit\n\n");
 	printf("	-h print help panel & exit\n\n");
 }
 
@@ -65,7 +68,7 @@ convert_text_color_code(void)
 }
 
 static void
-draw(int border, char **lines, int linecount, int linestart)
+draw(int border, char **lines, int linecount, int linestart, int duration)
 {
 	char text_color_pnd[8];
 	strncpy(text_color_pnd, convert_text_color_code(), 8);
@@ -141,15 +144,15 @@ main(int argc, char **argv)
 	char text[BUFFER];
 	extern char *optarg;
 
-	while ((c = getopt(argc, argv, "s:b:t:g:r:vh")) != -1 ) {
+	while ((c = getopt(argc, argv, "d:b:t:g:r:vh")) != -1 ) {
 		switch (c) {
 		case 'v':
 			die(VERSION, EXIT_SUCCESS);
 		case 'h':
 			help();
 			usage(argv[0]);
-		case 's':
-			s=atoi(optarg);
+		case 'd':
+			duration=atoi(optarg);
 			break;
 		case 'b':
 			border_width=atoi(optarg); /* overwrite default in config.h */
@@ -166,7 +169,7 @@ main(int argc, char **argv)
 		}
 	}
 
-	draw(border_width, argv, argc, optind);
+	draw(border_width, argv, argc, optind, duration);
 
 	return 0;
 }