summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2013-12-17 14:45:14 -0400
committerJoey Hess <joey@kitenet.net>2013-12-17 14:45:14 -0400
commit7b00ce7fd69ca23fedd8aa0f2debc391a07233ec (patch)
tree86af3db682f74e8ca2bf14a0eebafb20400275f5
parente9a11d7cc301353dcf621cf3f4ad7d69c75e4b38 (diff)
Added -i to display as icon. Thanks, Tovar Closes: #732398
-rw-r--r--Makefile2
-rw-r--r--debian/changelog6
-rw-r--r--wmbattery.1x3
-rw-r--r--wmbattery.c9
4 files changed, 18 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index e9fcce8..b5262d5 100644
--- a/Makefile
+++ b/Makefile
@@ -35,6 +35,8 @@ upower.o: upower.c
$(CC) $(CPPFLAGS) $(CFLAGS) $(shell pkg-config --cflags upower-glib) -c upower.c -o upower.o
endif
+LIBS+=-lapm -lXext -lXpm
+
wmbattery: $(OBJS)
$(CC) -o wmbattery $(LDFLAGS) $(OBJS) $(LIBS)
diff --git a/debian/changelog b/debian/changelog
index c0f8d70..af7575e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+wmbattery (2.43) UNRELEASED; urgency=low
+
+ * Added -i to display as icon. Thanks, Tovar Closes: #732398
+
+ -- Joey Hess <joeyh@debian.org> Tue, 17 Dec 2013 14:44:44 -0400
+
wmbattery (2.42) unstable; urgency=medium
* Stop building with flash-in-the-pan HAL. Instead update acpi
diff --git a/wmbattery.1x b/wmbattery.1x
index 79bcf77..c2bb88c 100644
--- a/wmbattery.1x
+++ b/wmbattery.1x
@@ -103,5 +103,8 @@ estimating time. (Implies -e)
.B \-a file.au
Play the specified au file (by sending it to /dev/audio) when the battery
is low.
+.TP
+.B \-i
+Display as icon.
.SH AUTHOR
Joey Hess <joey@kitenet.net>
diff --git a/wmbattery.c b/wmbattery.c
index bdd4b92..91b98b8 100644
--- a/wmbattery.c
+++ b/wmbattery.c
@@ -52,6 +52,7 @@ int use_acpi = 0;
int delay = 0;
int always_estimate_remaining = 0;
int granularity_estimate_remaining = 1;
+int initial_state = WithdrawnState;
signed int low_pct = -1;
signed int critical_pct = -1;
@@ -214,13 +215,14 @@ char *parse_commandline(int argc, char *argv[]) {
extern char *optarg;
while (c != -1) {
- c=getopt(argc, argv, "hd:g:f:b:w:c:l:es:a:");
+ c=getopt(argc, argv, "hd:g:if:b:w:c:l:es:a:");
switch (c) {
case 'h':
printf("Usage: wmbattery [options]\n");
printf("\t-d <display>\tselects target display\n");
printf("\t-h\t\tdisplay this help\n");
printf("\t-g +x+y\t\tposition of the window\n");
+ printf("\t-i start \n");
printf("\t-b num\t\tnumber of battery to display\n");
printf("\t-w secs\t\tseconds between updates\n");
printf("\t-l percent\tlow percentage\n");
@@ -245,6 +247,9 @@ char *parse_commandline(int argc, char *argv[]) {
}
}
break;
+ case 'i':
+ initial_state = IconicState;
+ break;
case 'b':
battnum = atoi(optarg);
break;
@@ -339,7 +344,7 @@ void make_window(char *display_name, int argc, char *argv[]) {
XShapeCombineMask(display, iconwin, ShapeBounding, 0, 0,
pixmask, ShapeSet);
- wmhints.initial_state = WithdrawnState;
+ wmhints.initial_state = initial_state;
wmhints.icon_window = iconwin;
wmhints.icon_x = sizehints.x;
wmhints.icon_y = sizehints.y;