--- xbattbar.c.orig	Sat Jan 12 01:11:08 2002
+++ xbattbar.c	Sat Jan 12 01:27:10 2002
@@ -35,7 +35,8 @@
 #include <X11/Xlib.h>
 
 #define PollingInterval 10	/* APM polling interval in sec */
-#define BI_THICKNESS    3	/* battery indicator thickness in pixels */
+#define BI_THICKNESS	4	/* battery indicator thickness in pixels */
+#define BI_GAP		1	/* gap between indicator and edge of screen */
 
 #define BI_Bottom	0
 #define BI_Top		1
@@ -76,6 +77,7 @@
 int bi_width;                       /* width of Battery Indicator */
 int bi_x;                           /* x coordinate of upper left corner */
 int bi_y;                           /* y coordinate of upper left corner */
+int bi_gap = BI_GAP;                /* thickness of Battery Indicator */
 int bi_thick = BI_THICKNESS;        /* thickness of Battery Indicator */
 int bi_interval = PollingInterval;  /* interval of polling APM */
 
@@ -117,12 +119,13 @@
 {
   fprintf(stderr,
     "\n"	  
-    "usage:\t%s [-a] [-h|v] [-p sec] [-t thickness]\n"
+    "usage:\t%s [-a] [-h|v] [-p sec] [-t thickness] [-g gap]\n"
     "\t\t[-I color] [-O color] [-i color] [-o color]\n"
     "\t\t[ top | bottom | left | right ]\n"
     "-a:     always on top.\n"
     "-v, -h: show this message.\n"
-    "-t:     bar (indicator) thickness. [def: 3 pixels]\n"
+    "-t:     bar (indicator) thickness. [def: 4 pixels]\n"
+    "-g:     gap between bar and edge of screen. [def: 1 pixel]\n"
     "-p:     polling interval. [def: 10 sec.]\n"
     "-I, -O: bar colors in AC on-line. [def: \"green\" & \"olive drab\"]\n"
     "-i, -o: bar colors in AC off-line. [def: \"blue\" and \"red\"]\n"
@@ -182,24 +185,24 @@
     bi_width = width;
     bi_height = bi_thick;
     bi_x = 0;
-    bi_y = 0;
+    bi_y = bi_gap;
     break;
   case BI_Bottom:
     bi_width = width;
     bi_height = bi_thick;
     bi_x = 0;
-    bi_y = height - bi_thick;
+    bi_y = height - bi_thick - bi_gap;
     break;
   case BI_Left:
     bi_width = bi_thick;
     bi_height = height;
-    bi_x = 0;
+    bi_x = bi_gap;
     bi_y = 0;
     break;
   case BI_Right:
     bi_width = bi_thick;
     bi_height = height;
-    bi_x = width - bi_thick;
+    bi_x = width - bi_thick - bi_gap;
     bi_y = 0;
   }
 
@@ -223,7 +226,7 @@
   int ch;
 
   about_this_program();
-  while ((ch = getopt(argc, argv, "at:f:hI:i:O:o:p:v")) != -1)
+  while ((ch = getopt(argc, argv, "at:f:g:hI:i:O:o:p:v")) != -1)
     switch (ch) {
     case 'a':
       alwaysontop = True;
@@ -232,6 +235,10 @@
     case 't':
     case 'f':
       bi_thick = atoi(optarg);
+      break;
+
+    case 'g':
+      bi_gap = atoi(optarg);
       break;
 
     case 'I':

