From d8f9c099fae88fab00be74b69e448744f3711331 Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Tue, 19 Mar 2013 18:38:14 +0000 Subject: - update to 2.7 Make patch for colours in volume output actually works. Add a patch for colours on low remaining battery Add a patch for colours on high CPU temperature --- x11/i3status/Makefile | 2 +- x11/i3status/distinfo | 4 +-- x11/i3status/files/patch-src__print_battery_info.c | 18 ++++++++++++ .../files/patch-src__print_cpu_temperature.c | 27 +++++++++++++++++ x11/i3status/files/patch-src__print_volume.c | 34 ++++++++++++++-------- 5 files changed, 70 insertions(+), 15 deletions(-) create mode 100644 x11/i3status/files/patch-src__print_battery_info.c create mode 100644 x11/i3status/files/patch-src__print_cpu_temperature.c (limited to 'x11') diff --git a/x11/i3status/Makefile b/x11/i3status/Makefile index 810459978530..713ce6d4b72c 100644 --- a/x11/i3status/Makefile +++ b/x11/i3status/Makefile @@ -1,7 +1,7 @@ # $FreeBSD$ PORTNAME= i3status -PORTVERSION= 2.6 +PORTVERSION= 2.7 CATEGORIES= x11 MASTER_SITES= http://i3wm.org/i3status/ diff --git a/x11/i3status/distinfo b/x11/i3status/distinfo index 1b8297261b1c..07b32b98abb5 100644 --- a/x11/i3status/distinfo +++ b/x11/i3status/distinfo @@ -1,2 +1,2 @@ -SHA256 (i3status-2.6.tar.bz2) = e7e710cc271887bcd22757269e1b00a5618fb53abdb3455140116b3d38797bce -SIZE (i3status-2.6.tar.bz2) = 34896 +SHA256 (i3status-2.7.tar.bz2) = 073f4e5de3bc5afc1f23c52ea52e2aa4b90ca8a012f28ba2c5fac3c33474a632 +SIZE (i3status-2.7.tar.bz2) = 37594 diff --git a/x11/i3status/files/patch-src__print_battery_info.c b/x11/i3status/files/patch-src__print_battery_info.c new file mode 100644 index 000000000000..81761e35328a --- /dev/null +++ b/x11/i3status/files/patch-src__print_battery_info.c @@ -0,0 +1,18 @@ +--- ./src/print_battery_info.c.orig 2013-03-19 21:06:48.190385644 +0100 ++++ ./src/print_battery_info.c 2013-03-19 21:06:52.551387042 +0100 +@@ -234,6 +234,15 @@ + minutes -= (hours * 60); + (void)snprintf(remainingbuf, sizeof(remainingbuf), "%02dh%02d", + max(hours, 0), max(minutes, 0)); ++ if (strncmp(threshold_type, "percentage", strlen(threshold_type)) == 0 ++ && present_rate < low_threshold) { ++ START_COLOR("color_bad"); ++ colorful_output = true; ++ } else if (strncmp(threshold_type, "time", strlen(threshold_type)) == 0 ++ && remaining < (u_int) low_threshold) { ++ START_COLOR("color_bad"); ++ colorful_output = true; ++ } + } + #elif defined(__OpenBSD__) + /* diff --git a/x11/i3status/files/patch-src__print_cpu_temperature.c b/x11/i3status/files/patch-src__print_cpu_temperature.c new file mode 100644 index 000000000000..21a57a932a8a --- /dev/null +++ b/x11/i3status/files/patch-src__print_cpu_temperature.c @@ -0,0 +1,27 @@ +--- ./src/print_cpu_temperature.c.orig 2013-03-19 21:07:05.089386424 +0100 ++++ ./src/print_cpu_temperature.c 2013-03-19 21:07:14.249384762 +0100 +@@ -14,6 +14,7 @@ + #include + #define TZ_ZEROC 2732 + #define TZ_KELVTOC(x) (((x) - TZ_ZEROC) / 10), abs(((x) - TZ_ZEROC) % 10) ++#define TZ_AVG(x) ((x) - TZ_ZEROC) / 10 + #endif + + #if defined(__OpenBSD__) +@@ -80,7 +81,16 @@ + if (sysctlbyname(path, &sysctl_rslt, &sysctl_size, NULL, 0)) + goto error; + ++ if (TZ_AVG(sysctl_rslt) >= max_threshold) { ++ START_COLOR("color_bad"); ++ colorful_output = true; ++ } + outwalk += sprintf(outwalk, "%d.%d", TZ_KELVTOC(sysctl_rslt)); ++ if (colorful_output) { ++ END_COLOR; ++ colorful_output = false; ++ } ++ + #elif defined(__OpenBSD__) + struct sensordev sensordev; + struct sensor sensor; diff --git a/x11/i3status/files/patch-src__print_volume.c b/x11/i3status/files/patch-src__print_volume.c index 0158eb0cdcb2..34c0a22651da 100644 --- a/x11/i3status/files/patch-src__print_volume.c +++ b/x11/i3status/files/patch-src__print_volume.c @@ -1,25 +1,35 @@ ---- ./src/print_volume.c.orig 2012-10-03 13:44:44.000000000 +0200 -+++ ./src/print_volume.c 2012-12-29 01:14:29.384748264 +0100 -@@ -175,8 +175,9 @@ +--- ./src/print_volume.c.orig 2013-03-19 21:06:34.895386349 +0100 ++++ ./src/print_volume.c 2013-03-19 21:06:39.429385083 +0100 +@@ -175,16 +175,32 @@ } #endif - #if defined(__FreeBSD__) || defined(__OpenBSD__) + #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) - char mixerpath[] = "/dev/mixer"; -+ char mixerpath[] = "/dev/mixer"; ++ char *mixerpath; ++ char defaultmixer[] = "/dev/mixer"; int mixfd, vol, devmask = 0; -+ int pbval = 1; ++ pbval = 1; ++ ++ if (mixer_idx >= 0) ++ asprintf(&mixerpath, "/dev/mixer%d", mixer_idx); ++ else ++ mixerpath = defaultmixer; if ((mixfd = open(mixerpath, O_RDWR)) < 0) return; -@@ -185,6 +186,12 @@ ++ ++ if (mixer_idx >= 0) ++ free(mixerpath); ++ + if (ioctl(mixfd, SOUND_MIXER_READ_DEVMASK, &devmask) == -1) + return; if (ioctl(mixfd, MIXER_READ(0),&vol) == -1) return; -+ if ((vol & 0x7f) == 0 && (vol >> 8) & 0x7f == 0) -+ pbval = 0; -+ -+ if (!pbval) -+ START_COLOR("color_bad"); ++ if (((vol & 0x7f) == 0) && (((vol >> 8) & 0x7f) == 0)) { ++ START_COLOR("color_degraded"); ++ pbval = 0; ++ } + const char *walk = fmt; for (; *walk != '\0'; walk++) { -- cgit v1.2.3