aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2>2007-05-09 17:43:16 +0000
committergotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2>2007-05-09 17:43:16 +0000
commitc39f3f6e2cf3623306b7df4ab5a670329d4c4e45 (patch)
tree4c19849ecced0dce228c1e33e64637c3da38cab6
parent686d65dbd94f6b23c4422ed0cfdc2f9d73574825 (diff)
downloaddzen-c39f3f6e2cf3623306b7df4ab5a670329d4c4e45.tar.gz
dzen-c39f3f6e2cf3623306b7df4ab5a670329d4c4e45.zip
added onstart, onquit events
git-svn-id: http://dzen.googlecode.com/svn/trunk@12 f2baff5b-bf2c-0410-a398-912abdc3d8b2
-rw-r--r--README50
-rw-r--r--action.c22
-rw-r--r--action.h2
-rw-r--r--config.mk4
-rw-r--r--main.c9
5 files changed, 66 insertions, 21 deletions
diff --git a/README b/README
index ad36c33..8e54030 100644
--- a/README
+++ b/README
@@ -1,14 +1,18 @@
-dzen
-=====
+==================================
+ dzen, (c) 2007 by Robert Manea
+==================================
+
A general purpose messaging, notification and launcher programm.
+Dzen can be used in a single line and/or multiple lines mode.
+
Features
--------
* scritable in any language
- * single line and/or multi
- line windows
+ * single line and/or windows
+ holding multiple lines
* menu functionality
* flexible event/action
mechanism
@@ -31,6 +35,12 @@ necessary as root):
make clean install
+Contact:
+--------
+Feature requests, patches or anything else related to dzen can be send
+to: rob dot manea at gmail dor com
+
+
Running dzen
------------
dzen accepts a couple of options:
@@ -74,7 +84,9 @@ user defined - set with 'exit:retval' action, see 3)
Hides the title window as soon as the pointer leaves it (default). This
very much resembles autohiding panels known from most desktops.
-Note: See the 3) for events/actions to use with autohide.
+Note: This option is obsolete and will be removed in future versions as
+ the same behaviour can be achieved with the 'onstart=hide' combination,
+ see 3) for further details.
2) Option "-l": Slave window
@@ -116,13 +128,15 @@ An example:
entertitle=uncollapse,unhide;
on entertitle (mouse pointer enters the title window) uncollapse
- multiline window and unhide the title window
+ slave window and unhide the title window
button3=exit
on button3 event exit dzen
Supported events:
+ onstart Perform actions right after startup
+ onquit Perform actions just before quitting
button1 Mouse button1 released
button2 Mouse button2 released
button3 Mouse button3 released
@@ -141,10 +155,10 @@ Supported actions:
exit:retval exit dzen and return 'retval'
print:str1:...:n write all given options to STDOUT
menuprint write selected menu entry to STDOUT
- collapse collapse multiline window
- uncollapse uncollapse multiline window
- stick stick multiline window
- unstick unstick multiline window
+ collapse collapse slave window
+ uncollapse uncollapse slave window
+ stick stick slave window
+ unstick unstick slave window
togglestick toggle sticky state
hide hide title window
unhide unhide title window
@@ -160,16 +174,10 @@ Note: If no events/actions are specified dzen defaults to:
button4=scrollup;button5=scrolldown'
If you define any events/actions, there is no default behaviour,
- i.e. you will need to specify _all_ events/actions you want to
+ i.e. you will have to specify _all_ events/actions you want to
use.
-Note: The hide/unhide actions can only be used if '-a' is supplied on
- the command line. This is subject to change as soon as a
- autohide action will be introduced.
-
-
-
4) Option '-m', Menu
--------------------
@@ -193,11 +201,11 @@ Examples:
* Display updating single line message:
for i in $(seq 1 20); do A=${A}'='; print $A; sleep 1; done | ./dzen2
-* Display header and multiline message:
+* Display header and a message with multiple lines:
(echo Header; cal; sleep 20) | dzen2 -l 8
Displays "Header" in the main alert window and
- the output of cal in the 8 lines high multiline
+ the output of cal in the 8 lines high slave
window.
* Display updating messages:
@@ -222,3 +230,7 @@ Examples:
{echo Procs; ps -a} | dzen2 -m -l 12 -p -e 'button1=menuprint;button3=exit;
button4=scrollup;button5=scrolldown;entertitle=uncollapse;leaveslave=collapse'
| awk '{print $1}'
+
+
+
+Have fun.
diff --git a/action.c b/action.c
index 0a65837..c0e090d 100644
--- a/action.c
+++ b/action.c
@@ -9,9 +9,12 @@
#include <stdlib.h>
#include <string.h>
+
struct event_lookup ev_lookup_table[] = {
{ "exposet", exposetitle},
{ "exposes", exposeslave},
+ { "onstart", onstart},
+ { "onquit", onquit},
{ "button1", button1},
{ "button2", button2},
{ "button3", button3},
@@ -273,6 +276,7 @@ a_scrolldown(char * opt[]) {
return 0;
}
+/*
int
a_hide(char * opt[]) {
if(dzen.title_win.autohide && !dzen.title_win.ishidden) {
@@ -290,6 +294,24 @@ a_unhide(char * opt[]) {
}
return 0;
}
+*/
+int
+a_hide(char * opt[]) {
+ if(!dzen.title_win.ishidden) {
+ XResizeWindow(dzen.dpy, dzen.title_win.win, dzen.title_win.width, 1);
+ dzen.title_win.ishidden = True;
+ }
+ return 0;
+}
+
+int
+a_unhide(char * opt[]) {
+ if(dzen.title_win.ishidden) {
+ XResizeWindow(dzen.dpy, dzen.title_win.win, dzen.title_win.width, dzen.mh);
+ dzen.title_win.ishidden = False;
+ }
+ return 0;
+}
int
a_exec(char * opt[]) {
diff --git a/action.h b/action.h
index 47ed4d7..311ca4c 100644
--- a/action.h
+++ b/action.h
@@ -15,6 +15,8 @@ typedef struct EV Ev;
enum ev_id {
/* internal events, should not be used by the user */
exposetitle, exposeslave,
+ /* startup, shutdown */
+ onstart, onquit,
/* mouse buttons */
button1, button2, button3, button4, button5,
/* entering/leaving windows */
diff --git a/config.mk b/config.mk
index 6663d07..db3dc5e 100644
--- a/config.mk
+++ b/config.mk
@@ -1,5 +1,5 @@
# dzen version
-VERSION = 0.2.0
+VERSION = 0.2.1
# Customize below to fit your system
@@ -17,7 +17,7 @@ LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 -lpthread
# flags
#CFLAGS = -Os ${INCS} -DVERSION=\"${VERSION}\"
#LDFLAGS = ${LIBS}
-CFLAGS = -g -Wall -Os ${INCS} -DVERSION=\"${VERSION}\" -DPOSIX_SOURCE
+CFLAGS = -g -Wall -O0 ${INCS} -DVERSION=\"${VERSION}\" -DPOSIX_SOURCE
LDFLAGS = -g ${LIBS}
# Solaris
diff --git a/main.c b/main.c
index c8fa7d4..f3fd4c3 100644
--- a/main.c
+++ b/main.c
@@ -358,9 +358,11 @@ main(int argc, char *argv[]) {
else if(!strncmp(argv[i], "-p", 3)) {
dzen.slave_win.ispersistent = True;
}
+ /*
else if(!strncmp(argv[i], "-a", 3)) {
dzen.title_win.autohide = True;
}
+ */
else if(!strncmp(argv[i], "-m", 3)) {
dzen.slave_win.ismenu = True;
}
@@ -434,9 +436,15 @@ main(int argc, char *argv[]) {
/* reader */
pthread_create(&dzen.read_thread, NULL, read_stdin, NULL);
+ /* actions to be done right after startup */
+ do_action(onstart);
+
/* catch events */
event_loop(NULL);
+ /* actions to be done right before quitting*/
+ do_action(onquit);
+
/* clean up */
if(!dzen.running)
pthread_cancel(dzen.read_thread);
@@ -458,6 +466,7 @@ main(int argc, char *argv[]) {
XDestroyWindow(dzen.dpy, dzen.title_win.win);
XCloseDisplay(dzen.dpy);
+
if(dzen.ret_val)
return dzen.ret_val;