]> mj.ucw.cz Git - osdd.git/commitdiff
Merge branch 'master' of ssh://git.ucw.cz/home/mj/GIT/osdd
authorMartin Mares <mj@ucw.cz>
Wed, 18 Aug 2010 23:43:28 +0000 (01:43 +0200)
committerMartin Mares <mj@ucw.cz>
Wed, 18 Aug 2010 23:43:28 +0000 (01:43 +0200)
Makefile
README [new file with mode: 0644]
osd-mpc-volume
osdd.c

index 75d67be126ccbf15262ff4cbc4faea2d6ef6f557..9bdb6ffb7ab47316be7c3c0730d550567c14ebda 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,13 @@
+VERSION=1.0
+ARCHIVE=osdd-$(VERSION).tar.gz
+
 CFLAGS=-O2 -Wall -W -Wno-parentheses -Wstrict-prototypes -Wmissing-prototypes -Wundef -Wredundant-decls -std=gnu99
 
 all: osdd osdc osd-batt
 
 osdd: osdd.o util.o
 osdc: osdc.o util.o client.o
-osd-batt: osd-batt.o util.o client.o loop.o
+osd-batt: osd-batt.o util.o client.o
 
 osdd.o: CFLAGS+=$(shell xosd-config --cflags)
 osdd: LDFLAGS+=$(shell xosd-config --libs)
@@ -14,3 +17,11 @@ osd-batt: LDFLAGS+=-lX11
 
 clean:
        rm -f *~ *.o TAGS core osdd osdc
+
+release:
+       git tag v$(VERSION)
+       git push --tags
+       git archive --format=tar --prefix=osdd-$(VERSION)/ HEAD | gzip >$(ARCHIVE)
+       scp $(ARCHIVE) atrey:~ftp/pub/local/mj/linux/
+       ssh jw "cd www && bin/release-prog osdd $(VERSION)"
+       mv $(ARCHIVE) ~/archives/mj/
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..c9b974d
--- /dev/null
+++ b/README
@@ -0,0 +1,71 @@
+================================================================================
+
+                           On-Screen Display Daemon
+
+                      (c) 2010 Martin Mares <mj@ucw.cz>
+
+       You can use and distribute this program under the terms of GPLv2.
+
+================================================================================
+
+
+OSDD is a simple daemon whose purpose is to wait for messages sent by other
+programs and display them on the screen using libxosd. Unlike other such
+daemons, it handles message attributes (like colors), keeps its eye on
+message timing and uses X properties to pass messages, so it works over SSH
+connections with X forwarding.
+
+I have developed osdd on Linux, but it should work on any recent POSIX-compliant
+system equipped with libX11 and libxosd.
+
+Please send all bug reports and suggestions to the author.
+
+Usage
+~~~~~
+When you run `osdd' without any parameters, it forks and waits in the background
+to serve the messages. It is convenient to invoke it from ~/.xsession, so that
+it is started with your X session. It should exit properly when the session
+terminates.
+
+The simplest way of sending messages to the daemon is using the `osdc' client,
+e.g., `osdc "Hello world!"'. Use multiple parameters to create a multi-line
+message (however, the maximum number of lines is fixed and it can be changed
+only by the `--lines' switch on daemon startup).
+
+You can also add attributes to the message (written as command-line options):
+
+  --color=c            Set foreground color of the message. Colors are specified
+                       either as #RGB, or #RRGGBB, or color names from X11 rgb.txt,
+                       or any other method documented in XParseColor(3).
+
+  --outline-color=c    Set color of character outlines.
+
+  --duration=ms                Show the message for a given number of miliseconds.
+
+  --min-duration=ms    When another message arrives while this one is displayed,
+                       the duration of this message can be shortened, but not
+                       below this parameter.
+
+  --percent=p          Draw a line with a percentage bar (p=0..100)
+
+  --slider=p           Draw a line with a slider (p=0..100)
+
+The default values of most of these attributes can be given by command-line
+options of the daemon, use `osdd --help' to get the full list.
+
+Any value can be replaced by "-", meaning "read from standard input".
+
+
+Example clients
+~~~~~~~~~~~~~~~
+
+osd-clock              Display current date and time (a shell script piping
+                       its output to osdc).
+
+osd-mpc-volume         Adjust volume of the MPD music player daemon and show
+                       a slider with the new value.
+
+osd-batt               A slightly more complex client written in C, showing
+                       the current status of laptop batteries. It can be asked
+                       to show status immediately or to run in background and
+                       croak whenever the battery is low.
index 76dce7b1df4a3fec40c26c6d8117d782be65c442..5c702fa06ad46f2927533c52e0e3ceb60092697b 100755 (executable)
@@ -3,4 +3,4 @@ if [ -z "$1" -o -n "$2" ] ; then
        echo >&2 "Usage: $0 [+|-]<percentage>"
        exit 1
 fi
-mpc volume $1 | sed 's/.*volume: \([0-9]\+\)%.*/\1/;t;d' | osdc 'MPC Volume' '' --percent=-
+mpc volume $1 | sed 's/.*volume: *\([0-9]\+\)%.*/\1/;t;d' | osdc 'MPC Volume' '' --percent=-
diff --git a/osdd.c b/osdd.c
index f5cd44f776b31819ae9665805aa0329a35a21a63..ba279b292816f88fffdb26fe45d666c26f077664 100644 (file)
--- a/osdd.c
+++ b/osdd.c
@@ -10,6 +10,7 @@
 #include <unistd.h>
 #include <poll.h>
 #include <getopt.h>
+#include <locale.h>
 #include <xosd.h>
 #include <X11/Xlib.h>
 #include <X11/Xatom.h>
@@ -28,7 +29,7 @@ static char *font_name = "-bitstream-bitstream vera sans-bold-r-normal-*-*-320-*
 static char *default_color = "green";
 static char *default_outline_color = "black";
 static int default_duration = 1000;
-static int default_min_duration = 1000;
+static int default_min_duration = 250;
 static int debug_mode;
 
 static const char short_opts[] = "c:d:Df:l:m:o:";
@@ -228,6 +229,7 @@ int
 main(int argc, char **argv)
 {
   parse_opts(argc, argv);
+  setlocale(LC_CTYPE, "");
   XInitThreads();
 
   Display *dpy = XOpenDisplay(NULL);