aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2>2007-07-15 11:01:42 +0000
committergotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2>2007-07-15 11:01:42 +0000
commit156afa81bd0e68d856cb29802426f5cfa7e6e616 (patch)
tree51c77aeb6fa9fa15c8d02b5f14af4d4b604948b2
parent6f1e53123f1aaec7f41ec7bc8ccffc499692ae76 (diff)
downloaddzen-156afa81bd0e68d856cb29802426f5cfa7e6e616.tar.gz
dzen-156afa81bd0e68d856cb29802426f5cfa7e6e616.zip
changed Makefile to be aware of the gadgets
added install rule to gadgets' Makefile updated TODO and README git-svn-id: http://dzen.googlecode.com/svn/trunk@123 f2baff5b-bf2c-0410-a398-912abdc3d8b2
-rw-r--r--Makefile2
-rw-r--r--README6
-rw-r--r--TODO10
-rw-r--r--action.c6
-rw-r--r--draw.c15
-rw-r--r--gadgets/Makefile12
-rw-r--r--gadgets/config.mk1
-rw-r--r--main.c23
8 files changed, 53 insertions, 22 deletions
diff --git a/Makefile b/Makefile
index dc5ead8..eded0df 100644
--- a/Makefile
+++ b/Makefile
@@ -34,7 +34,9 @@ clean:
dist: clean
@echo creating dist tarball
@mkdir -p dzen2-${VERSION}
+ @mkdir -p dzen2-${VERSION}/gadgets
@cp -R LICENSE Makefile README help config.mk action.h dzen.h ${SRC} dzen2-${VERSION}
+ @cp -R gadgets/Makefile gadgets/config.mk gadgets/README.dbar gadgets/dbar.c dzen2-${VERSION}/gadgets
@tar -cf dzen2-${VERSION}.tar dzen2-${VERSION}
@gzip dzen2-${VERSION}.tar
@rm -rf dzen2-${VERSION}
diff --git a/README b/README
index a619f7f..ce16e39 100644
--- a/README
+++ b/README
@@ -49,6 +49,12 @@ necessary as root):
make clean install
+Optionally if you want to use dzen's gadgets:
+
+ cd gadgets
+ make clean install
+
+
Note: By default dzen will not be compiled with Xinerama support.
Uncomment the respective lines in config.mk to change this.
diff --git a/TODO b/TODO
index 5b776ce..c5dd243 100644
--- a/TODO
+++ b/TODO
@@ -1,13 +1,15 @@
-# extend available events:
+# X related
+
+ o XRandR support
- o input changed event
# extend available actions
o set font action
- o actions acting like a switch should have a toggleaction function
o any other useful action
+
# user interface
- o split lines longer than window width in multiple lines
+ o dynamic coloring partial text
+ o support icons
diff --git a/action.c b/action.c
index 74a71a5..a83944f 100644
--- a/action.c
+++ b/action.c
@@ -66,7 +66,8 @@ new_event(long evid) {
head = emalloc(sizeof (ev_list));
head->id = evid;
head->next = NULL;
- } else {
+ }
+ else {
item = head;
/* check if we already handle this event */
while(item) {
@@ -342,7 +343,8 @@ scroll(int n) {
else if(dzen.slave_win.last_line_vis + n > dzen.slave_win.tcnt) {
dzen.slave_win.first_line_vis = dzen.slave_win.tcnt - dzen.slave_win.max_lines;
dzen.slave_win.last_line_vis = dzen.slave_win.tcnt;
- } else {
+ }
+ else {
dzen.slave_win.first_line_vis += n;
dzen.slave_win.last_line_vis += n;
}
diff --git a/draw.c b/draw.c
index 67e0ba1..327ffb5 100644
--- a/draw.c
+++ b/draw.c
@@ -44,7 +44,8 @@ drawtext(const char *text, int reverse, int line, int align) {
reverse ?
XSetForeground(dzen.dpy, mgc, dzen.norm[ColFG]):
XSetForeground(dzen.dpy, mgc, dzen.norm[ColBG]);
- } else {
+ }
+ else {
reverse ?
XSetForeground(dzen.dpy, mgc, dzen.slave_win.tbuf[line+dzen.slave_win.first_line_vis].fg):
XSetForeground(dzen.dpy, mgc, dzen.slave_win.tbuf[line+dzen.slave_win.first_line_vis].bg);
@@ -55,7 +56,8 @@ drawtext(const char *text, int reverse, int line, int align) {
reverse ?
XSetForeground(dzen.dpy, mgc, dzen.norm[ColBG]):
XSetForeground(dzen.dpy, mgc, dzen.norm[ColFG]);
- } else {
+ }
+ else {
reverse ?
XSetForeground(dzen.dpy, mgc, dzen.slave_win.tbuf[line+dzen.slave_win.first_line_vis].bg):
XSetForeground(dzen.dpy, mgc, dzen.slave_win.tbuf[line+dzen.slave_win.first_line_vis].fg);
@@ -91,7 +93,8 @@ drawtext(const char *text, int reverse, int line, int align) {
x = (dzen.slave_win.width - textw(buf)+h)/2;
else
x = dzen.slave_win.width - textw(buf);
- } else {
+ }
+ else {
if(!align)
x = (dzen.w - textw(buf)+h)/2;
else if(align == ALIGNLEFT)
@@ -197,7 +200,8 @@ setlinecolor(const char * text, unsigned long * colfg, unsigned long * colbg) {
*colbg = newbg;
return text+16;
- } else
+ }
+ else
*colbg = dzen.norm[ColBG];
return text+8;
@@ -243,7 +247,8 @@ drawbody(char * text) {
dzen.slave_win.tbuf[dzen.slave_win.tcnt].fg = colfg;
dzen.slave_win.tbuf[dzen.slave_win.tcnt].bg = colbg;
dzen.slave_win.tbuf[dzen.slave_win.tcnt].text = estrdup(ctext);
- } else {
+ }
+ else {
dzen.slave_win.tbuf[dzen.slave_win.tcnt].fg = dzen.norm[ColFG];
dzen.slave_win.tbuf[dzen.slave_win.tcnt].bg = dzen.norm[ColBG];
dzen.slave_win.tbuf[dzen.slave_win.tcnt].text = estrdup(text);
diff --git a/gadgets/Makefile b/gadgets/Makefile
index 0c62392..db0cc74 100644
--- a/gadgets/Makefile
+++ b/gadgets/Makefile
@@ -30,4 +30,14 @@ clean:
@echo cleaning
@rm -f ${OBJ} dbar
-.PHONY: all options clean
+install: all
+ @echo installing executable file to ${DESTDIR}${PREFIX}/bin
+ @mkdir -p ${DESTDIR}${PREFIX}/bin
+ @cp -f dbar ${DESTDIR}${PREFIX}/bin
+ @chmod 755 ${DESTDIR}${PREFIX}/bin/dbar
+
+uninstall:
+ @echo removing executable file from ${DESTDIR}${PREFIX}/bin
+ @rm -f ${DESTDIR}${PREFIX}/bin/dbar
+
+.PHONY: all options clean install uninstall
diff --git a/gadgets/config.mk b/gadgets/config.mk
index df25ba3..9dd7697 100644
--- a/gadgets/config.mk
+++ b/gadgets/config.mk
@@ -6,7 +6,6 @@ MANPREFIX = ${PREFIX}/share/man
INCS = -I. -I/usr/include
-# No Xinerama, comment the following two lines for Xinerama
LIBS = -L/usr/lib
CFLAGS = -Os ${INCS}
LDFLAGS = ${LIBS}
diff --git a/main.c b/main.c
index 531b10f..9e4b1c6 100644
--- a/main.c
+++ b/main.c
@@ -108,7 +108,8 @@ chomp(char *inbuf, char *outbuf, int start, int len) {
}
if(inbuf[off] != '\n') {
outbuf[i++] = inbuf[off++];
- } else if(inbuf[off] == '\n') {
+ }
+ else if(inbuf[off] == '\n') {
outbuf[i] = '\0';
return ++off;
}
@@ -143,9 +144,11 @@ read_stdin(void) {
if(!dzen.ispersistent) {
dzen.running = False;
return -1;
- } else
+ }
+ else
return -2;
- } else {
+ }
+ else {
while((n_off = chomp(buf, retbuf, n_off, n))) {
if(!dzen.slave_win.ishmenu
&& dzen.tsupdate
@@ -165,14 +168,14 @@ read_stdin(void) {
}
static void
-x_highlight_line(int line) {
+x_hilight_line(int line) {
drawtext(dzen.slave_win.tbuf[line + dzen.slave_win.first_line_vis].text, 1, line, dzen.slave_win.alignment);
XCopyArea(dzen.dpy, dzen.slave_win.drawable[line], dzen.slave_win.line[line], dzen.rgc,
0, 0, dzen.slave_win.width, dzen.line_height, 0, 0);
}
static void
-x_unhighlight_line(int line) {
+x_unhilight_line(int line) {
drawtext(dzen.slave_win.tbuf[line + dzen.slave_win.first_line_vis].text, 0, line, dzen.slave_win.alignment);
XCopyArea(dzen.dpy, dzen.slave_win.drawable[line], dzen.slave_win.line[line], dzen.gc,
0, 0, dzen.slave_win.width, dzen.line_height, 0, 0);
@@ -262,7 +265,8 @@ queryscreeninfo(Display *dpy, XRectangle *rect, int screen) {
if(xsi == NULL || screen > nscreens || screen <= 0) {
qsi_no_xinerama(dpy, rect);
- } else {
+ }
+ else {
rect->x = xsi[screen-1].x_org;
rect->y = xsi[screen-1].y_org;
rect->width = xsi[screen-1].width;
@@ -282,7 +286,8 @@ set_net_wm_strut_partial_for(Display *dpy, Window w) {
strut[2] = wa.height;
strut[8] = wa.x;
strut[9] = wa.x + wa.width - 1;
- } else if((wa.y + wa.height) == DisplayHeight(dpy, DefaultScreen(dpy))) {
+ }
+ else if((wa.y + wa.height) == DisplayHeight(dpy, DefaultScreen(dpy))) {
strut[3] = wa.height;
strut[10] = wa.x;
strut[11] = wa.x + wa.width - 1;
@@ -460,7 +465,7 @@ handle_xev(void) {
if(dzen.slave_win.ismenu) {
for(i=0; i < dzen.slave_win.max_lines; i++)
if(ev.xcrossing.window == dzen.slave_win.line[i])
- x_highlight_line(i);
+ x_hilight_line(i);
}
if(!dzen.slave_win.ishmenu
&& ev.xcrossing.window == dzen.title_win.win)
@@ -472,7 +477,7 @@ handle_xev(void) {
if(dzen.slave_win.ismenu) {
for(i=0; i < dzen.slave_win.max_lines; i++)
if(ev.xcrossing.window == dzen.slave_win.line[i])
- x_unhighlight_line(i);
+ x_unhilight_line(i);
}
if(!dzen.slave_win.ishmenu
&& ev.xcrossing.window == dzen.title_win.win)