wmbattery: Add -n option to disable dial graphic.
Thanks to Christoph Fritz for the feature request.
This commit is contained in:
parent
0b45f308ad
commit
81e95eabca
46
wmbattery/mask_nodial.xbm
Normal file
46
wmbattery/mask_nodial.xbm
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
#define mask_nodial_width 64
|
||||||
|
#define mask_nodial_height 64
|
||||||
|
static char mask_nodial_bits[] = {
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0xc0, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0x03, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00,
|
||||||
|
0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0xc0, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0x03, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00,
|
||||||
|
0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0xc0, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0x03, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00,
|
||||||
|
0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0xc0, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0x03, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00,
|
||||||
|
0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0xc0, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f,
|
||||||
|
0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f,
|
||||||
|
0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f,
|
||||||
|
0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f,
|
||||||
|
0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f,
|
||||||
|
0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f,
|
||||||
|
0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
|
@ -111,6 +111,9 @@ translated into the appropriate values.
|
||||||
.TP
|
.TP
|
||||||
.B \-i
|
.B \-i
|
||||||
Display as icon.
|
Display as icon.
|
||||||
|
.TP
|
||||||
|
.B \-n
|
||||||
|
Disable dial graphic.
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
Start at 10% battery to execute 'echo' including status information:
|
Start at 10% battery to execute 'echo' including status information:
|
||||||
.RS
|
.RS
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "mask.xbm"
|
#include "mask.xbm"
|
||||||
|
#include "mask_nodial.xbm"
|
||||||
#include "sonypi.h"
|
#include "sonypi.h"
|
||||||
#include "acpi.h"
|
#include "acpi.h"
|
||||||
#ifdef HAL
|
#ifdef HAL
|
||||||
|
@ -83,6 +84,7 @@ int delay = 0;
|
||||||
int always_estimate_remaining = 0;
|
int always_estimate_remaining = 0;
|
||||||
int granularity_estimate_remaining = 1;
|
int granularity_estimate_remaining = 1;
|
||||||
int initial_state = WithdrawnState;
|
int initial_state = WithdrawnState;
|
||||||
|
int use_dial = 1;
|
||||||
|
|
||||||
signed int low_pct = -1;
|
signed int low_pct = -1;
|
||||||
signed int critical_pct = -1;
|
signed int critical_pct = -1;
|
||||||
|
@ -378,7 +380,7 @@ char *parse_commandline(int argc, char *argv[])
|
||||||
char *ret = NULL;
|
char *ret = NULL;
|
||||||
|
|
||||||
while (c != -1) {
|
while (c != -1) {
|
||||||
c = getopt(argc, argv, "hd:g:if:b:w:c:l:es:a:x:v");
|
c = getopt(argc, argv, "hd:g:if:b:w:c:l:es:a:x:vn");
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'h':
|
case 'h':
|
||||||
printf("Usage: wmbattery [options]\n");
|
printf("Usage: wmbattery [options]\n");
|
||||||
|
@ -394,6 +396,7 @@ char *parse_commandline(int argc, char *argv[])
|
||||||
printf("\t-s granularity\tignore fluctuations less than granularity%% (implies -e)\n");
|
printf("\t-s granularity\tignore fluctuations less than granularity%% (implies -e)\n");
|
||||||
printf("\t-a file\t\twhen critical send file to /dev/audio\n");
|
printf("\t-a file\t\twhen critical send file to /dev/audio\n");
|
||||||
printf("\t-x command\twhen critical execute this command\n");
|
printf("\t-x command\twhen critical execute this command\n");
|
||||||
|
printf("\t-n\t\tdisable dial graphic\n");
|
||||||
printf("\t-v\t\tdisplay version number\n");
|
printf("\t-v\t\tdisplay version number\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
break;
|
break;
|
||||||
|
@ -435,6 +438,9 @@ char *parse_commandline(int argc, char *argv[])
|
||||||
printf("wmbattery "PACKAGE_VERSION"\n");
|
printf("wmbattery "PACKAGE_VERSION"\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
break;
|
break;
|
||||||
|
case 'n':
|
||||||
|
use_dial = 0;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,8 +506,12 @@ void make_window(char *display_name, int argc, char *argv[])
|
||||||
GCForeground | GCBackground | GCGraphicsExposures,
|
GCForeground | GCBackground | GCGraphicsExposures,
|
||||||
&gcv);
|
&gcv);
|
||||||
|
|
||||||
pixmask = XCreateBitmapFromData(display, win, mask_bits,
|
if (use_dial)
|
||||||
|
pixmask = XCreateBitmapFromData(display, win, mask_bits,
|
||||||
mask_width, mask_height);
|
mask_width, mask_height);
|
||||||
|
else
|
||||||
|
pixmask = XCreateBitmapFromData(display, win, mask_nodial_bits,
|
||||||
|
mask_nodial_width, mask_nodial_height);
|
||||||
XShapeCombineMask(display, win, ShapeBounding, 0, 0,
|
XShapeCombineMask(display, win, ShapeBounding, 0, 0,
|
||||||
pixmask, ShapeSet);
|
pixmask, ShapeSet);
|
||||||
XShapeCombineMask(display, iconwin, ShapeBounding, 0, 0,
|
XShapeCombineMask(display, iconwin, ShapeBounding, 0, 0,
|
||||||
|
|
Loading…
Reference in a new issue