- implement colors too for threshold_type=time in the battery block.
This commit is contained in:
parent
fc8fe31412
commit
79a9f13d39
@ -1,11 +1,11 @@
|
||||
# $OpenBSD: Makefile,v 1.12 2012/10/08 10:33:39 jasper Exp $
|
||||
# $OpenBSD: Makefile,v 1.13 2012/10/08 11:12:53 jasper Exp $
|
||||
|
||||
ONLY_FOR_ARCHS= ${APM_ARCHS}
|
||||
|
||||
COMMENT= generate a statusbar for use with i3/xmobar/dzen2
|
||||
|
||||
DISTNAME= i3status-2.6
|
||||
REVISION= 3
|
||||
REVISION= 4
|
||||
CATEGORIES= x11 sysutils
|
||||
|
||||
HOMEPAGE= http://i3wm.org/i3status/
|
||||
|
@ -1,21 +1,21 @@
|
||||
$OpenBSD: patch-src_print_battery_info_c,v 1.5 2012/10/08 10:33:39 jasper Exp $
|
||||
$OpenBSD: patch-src_print_battery_info_c,v 1.6 2012/10/08 11:12:54 jasper Exp $
|
||||
|
||||
- fix the battery status printing in %status.
|
||||
- fix remaining time when we're charging.
|
||||
- use colors to indicate battery status (currently only implemented for "threshold_type=percentage"
|
||||
- use colors to indicate battery status
|
||||
|
||||
--- src/print_battery_info.c.orig Wed Oct 3 13:44:44 2012
|
||||
+++ src/print_battery_info.c Mon Oct 8 14:29:50 2012
|
||||
+++ src/print_battery_info.c Mon Oct 8 15:09:53 2012
|
||||
@@ -228,7 +228,7 @@ void print_battery_info(yajl_gen json_gen, char *buffe
|
||||
* probing acpi(4) devices.
|
||||
*/
|
||||
struct apm_power_info apm_info;
|
||||
- int apm_fd, ac_status, charging;
|
||||
+ int apm_fd, charging;
|
||||
+ int apm_fd, charging, seconds_remaining;
|
||||
|
||||
apm_fd = open("/dev/apm", O_RDONLY);
|
||||
if (apm_fd < 0) {
|
||||
@@ -249,26 +249,38 @@ void print_battery_info(yajl_gen json_gen, char *buffe
|
||||
@@ -249,26 +249,41 @@ void print_battery_info(yajl_gen json_gen, char *buffe
|
||||
|
||||
switch(apm_info.ac_state) {
|
||||
case APM_AC_OFF:
|
||||
@ -37,11 +37,14 @@ $OpenBSD: patch-src_print_battery_info_c,v 1.5 2012/10/08 10:33:39 jasper Exp $
|
||||
(void)snprintf(percentagebuf, sizeof(percentagebuf), "%02d%%", apm_info.battery_life);
|
||||
|
||||
+ if (status == CS_DISCHARGING && low_threshold > 0) {
|
||||
+ /* XXX: Implement for "time" too. */
|
||||
+ if (strncmp(threshold_type, "percentage", strlen(threshold_type)) == 0
|
||||
+ && apm_info.battery_life < low_threshold) {
|
||||
+ START_COLOR("color_bad");
|
||||
+ colorful_output = true;
|
||||
+ } else if (strncmp(threshold_type, "time", strlen(threshold_type)) == 0
|
||||
+ && apm_info.minutes_left < low_threshold) {
|
||||
+ START_COLOR("color_bad");
|
||||
+ colorful_output = true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
Loading…
Reference in New Issue
Block a user