aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2>2007-11-27 12:04:24 +0000
committergotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2>2007-11-27 12:04:24 +0000
commit9d42d81a58a767d51cffc964fa8b3320f4094e11 (patch)
tree98bb359317676f0d9519097bc10b2de9b2a49466
parent5b63308bfc7b2490561350fcccc340ded9cc2a06 (diff)
downloaddzen-9d42d81a58a767d51cffc964fa8b3320f4094e11.tar.gz
dzen-9d42d81a58a767d51cffc964fa8b3320f4094e11.zip
added -geometry option, allows relative positioning
git-svn-id: http://dzen.googlecode.com/svn/trunk@170 f2baff5b-bf2c-0410-a398-912abdc3d8b2
-rw-r--r--README5
-rw-r--r--README.dzen4
-rw-r--r--dzen.h8
-rwxr-xr-xgadgets/kittscanner.sh8
-rw-r--r--main.c31
5 files changed, 42 insertions, 14 deletions
diff --git a/README b/README
index 2ddac30..40adf13 100644
--- a/README
+++ b/README
@@ -433,7 +433,10 @@ Other:
the input after the command will be drawn
to the title window, so it is best used
only once and as first command per line.
- Subject to be improved in the future.
+
+ ^cs() clear slave window
+ This command must be the first and only command
+ per line.
^ib(VALUE) ignore background setting, VALUE can be either
1 to ignore or 0 to not ignore the bg color set
diff --git a/README.dzen b/README.dzen
index 9a84b59..9332164 100644
--- a/README.dzen
+++ b/README.dzen
@@ -434,6 +434,10 @@ Other:
only once and as first command per line
Subject to be improved in the future.
+ ^^cs() clear slave window
+ This command must be the first and only command
+ per line.
+
^^ib(VALUE) ignore background setting, VALUE can be either
1 to ignore or 0 to not ignore the bg color set
with ^^bg(color)
diff --git a/dzen.h b/dzen.h
index 6e526e4..f0c615c 100644
--- a/dzen.h
+++ b/dzen.h
@@ -124,15 +124,15 @@ void x_draw_body(void);
extern void drawtext(const char *text,
int reverse,
int line,
- int aligne);
+ int align);
extern char * parse_line(const char * text,
int linenr,
int align,
int reverse,
int nodraw);
-extern long getcolor(const char *colstr); /* returns color of colstr */
-extern void setfont(const char *fontstr); /* sets global font */
-extern unsigned int textw(const char *text); /* returns width of text in px */
+extern long getcolor(const char *colstr); /* returns color of colstr */
+extern void setfont(const char *fontstr); /* sets global font */
+extern unsigned int textw(const char *text); /* returns width of text in px */
extern void drawheader(const char *text);
extern void drawbody(char *text);
diff --git a/gadgets/kittscanner.sh b/gadgets/kittscanner.sh
index 9059cf7..7ed186e 100755
--- a/gadgets/kittscanner.sh
+++ b/gadgets/kittscanner.sh
@@ -19,10 +19,8 @@ BG=black
SLEEP=0.1
-#DZEN=/usr/local/bin/dzen2
-DZEN=../dzen2
-#DZENOPTS="-bg $BG -fg $INACTIVE_LED_COLOR"
-DZENOPTS="-bg $BG -fg $INACTIVE_LED_COLOR -xs 1 -y 30"
+DZEN=dzen2
+DZENOPTS="-bg $BG -fg $INACTIVE_LED_COLOR"
#-----------------------------------------------------------------------
@@ -70,4 +68,4 @@ while :; do
j=`expr $j $SIGN 1`
sleep $SLEEP;
-done | $DZEN $DZENOPTS
+done | $DZEN $DZENOPTS -h `expr $LED_HEIGHT + 4`
diff --git a/main.c b/main.c
index 469f431..4b69079 100644
--- a/main.c
+++ b/main.c
@@ -212,8 +212,14 @@ x_draw_body(void) {
static void
x_check_geometry(XRectangle si) {
- dzen.title_win.x += si.x;
- dzen.title_win.y += si.y;
+
+ dzen.title_win.x = dzen.title_win.x < 0 ?
+ si.width + dzen.title_win.x + si.x :
+ dzen.title_win.x + si.x;
+ dzen.title_win.y = dzen.title_win.y < 0 ?
+ si.height + dzen.title_win.y + si.y :
+ dzen.title_win.y + si.x;
+
if(dzen.title_win.x > si.x + si.width)
dzen.title_win.x = si.x;
@@ -500,7 +506,7 @@ handle_xev(void) {
if(ev.xcrossing.window == dzen.slave_win.line[i])
x_hilight_line(i);
}
- if(!dzen.slave_win.ishmenu
+if(!dzen.slave_win.ishmenu
&& ev.xcrossing.window == dzen.title_win.win)
do_action(entertitle);
if(ev.xcrossing.window == dzen.slave_win.win)
@@ -710,6 +716,23 @@ main(int argc, char *argv[]) {
init_input_buffer();
}
}
+ else if(!strncmp(argv[i], "-geometry", 8)) {
+ if(++i < argc) {
+ int t;
+ unsigned int tx, ty, tw, th;
+
+ t = XParseGeometry(argv[i], &tx, &ty, &tw, &th);
+
+ if(t & XValue)
+ dzen.title_win.x = (signed int) tx;
+ if(t & YValue)
+ dzen.title_win.y = (signed int) ty;
+ if(t & WidthValue)
+ dzen.title_win.width = (signed int) tw;
+ if(t & HeightValue)
+ dzen.line_height = (signed int) th;
+ }
+ }
else if(!strncmp(argv[i], "-u", 3)){
dzen.tsupdate = True;
}
@@ -770,7 +793,7 @@ main(int argc, char *argv[]) {
eprint("dzen-"VERSION", (C)opyright 2007 Robert Manea\n");
else
eprint("usage: dzen2 [-v] [-p [seconds]] [-m [v|h]] [-ta <l|c|r>] [-sa <l|c|r>]\n"
- " [-x <pixel>] [-y <pixel>] [-w <pixel>] [-tw <pixel>] [-u] \n"
+ " [-geometry <g>] [-x <pixel>] [-y <pixel>] [-w <pixel>] [-tw <pixel>] [-u] \n"
" [-e <string>] [-l <lines>] [-fn <font>] [-bg <color>] [-fg <color>]\n"
#ifdef DZEN_XINERAMA
" [-xs <screen>]\n"