i3status: update patches

This commit is contained in:
Leonid Pliushch 2019-07-19 02:35:41 +03:00 committed by Yaksh Bariya
parent 6d357a3b6f
commit 48a33b40c5
No known key found for this signature in database
GPG Key ID: F7486BA7D3D27581
10 changed files with 182 additions and 149 deletions

View File

@ -6,17 +6,8 @@ TERMUX_PKG_VERSION=2.13
TERMUX_PKG_SRCURL=https://i3wm.org/i3status/i3status-${TERMUX_PKG_VERSION}.tar.bz2
TERMUX_PKG_SHA256=ce89c9ff8565f62e88299f1a611229afdfc356b4e97368a5f8c4f06ad2fa1466
TERMUX_PKG_DEPENDS="libandroid-glob, libconfuse, libnl, libpulseaudio, yajl"
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_CONFFILES="etc/i3status.conf"
termux_step_pre_configure() {
## Not working on Android
rm -f src/print_battery_info.c
## No ALSA available in Termux
rm -f src/print_volume.c
## 1. getloadavg() is not available on Android
## 2. /proc/loadavg is not accessible on Android 8.0 (Oreo)
rm -f src/print_load.c
autoreconf -fi
}

View File

@ -1,45 +0,0 @@
diff -uNr i3status-2.12/Makefile i3status-2.12.mod/Makefile
--- i3status-2.12/Makefile 2018-05-11 12:10:46.000000000 +0300
+++ i3status-2.12.mod/Makefile 2018-06-21 19:33:34.403580664 +0300
@@ -1,21 +1,17 @@
TOPDIR=$(shell pwd)
ifndef PREFIX
- PREFIX=/usr
+ PREFIX=@TERMUX_PREFIX@
endif
ifndef MANPREFIX
MANPREFIX=$(PREFIX)
endif
ifndef SYSCONFDIR
- ifeq ($(PREFIX),/usr)
- SYSCONFDIR=/etc
- else
- SYSCONFDIR=$(PREFIX)/etc
- endif
+ SYSCONFDIR=@TERMUX_PREFIX@/etc
endif
PKG_CONFIG ?= pkg-config
-CFLAGS+=-Wall -Wshadow -Wpointer-arith -Wcast-qual -Wsign-compare
+CFLAGS+=-Wall -Wshadow -Wpointer-arith -Wcast-qual -Wsign-compare -DLINUX
CFLAGS+=-g
CFLAGS+=-std=gnu99
CFLAGS+=-pedantic
@@ -26,7 +22,7 @@
LIBS+=-lyajl
LIBS+=-lpulse
LIBS+=-lm
-LIBS+=-lpthread
+LIBS+=-landroid-glob
ifeq ($(wildcard .git),)
# not in git repository
@@ -43,7 +39,6 @@
CPPFLAGS+=-D_GNU_SOURCE
CFLAGS += $(shell $(PKG_CONFIG) --cflags libnl-genl-3.0)
LIBS += $(shell $(PKG_CONFIG) --libs libnl-genl-3.0)
-LIBS+=-lasound
endif
ifeq ($(OS),GNU/kFreeBSD)

View File

@ -1,51 +0,0 @@
diff -uNr i3status-2.12/i3status.conf i3status-2.12.mod/i3status.conf
--- i3status-2.12/i3status.conf 2018-05-11 12:10:46.000000000 +0300
+++ i3status-2.12.mod/i3status.conf 2018-06-21 19:34:01.046914197 +0300
@@ -7,41 +7,18 @@
# If the above line is not correctly displayed, fix your editor first!
general {
- colors = true
- interval = 5
+ colors = true
+ interval = 5
}
-order += "ipv6"
-order += "disk /"
-order += "wireless _first_"
-order += "ethernet _first_"
-order += "battery all"
-order += "load"
+order += "disk /data"
order += "tztime local"
-wireless _first_ {
- format_up = "W: (%quality at %essid) %ip"
- format_down = "W: down"
-}
-
-ethernet _first_ {
- # if you use %speed, i3status requires root privileges
- format_up = "E: %ip (%speed)"
- format_down = "E: down"
-}
-
-battery all {
- format = "%status %percentage %remaining"
+disk "/data" {
+ format = "/data (%avail avail)"
}
tztime local {
- format = "%Y-%m-%d %H:%M:%S"
+ format = "%Y-%m-%d %H:%M:%S"
}
-load {
- format = "%1min"
-}
-
-disk "/" {
- format = "%avail"
-}

View File

@ -1,12 +0,0 @@
diff -uNr i3status-2.12/src/print_disk_info.c i3status-2.12.mod/src/print_disk_info.c
--- i3status-2.12/src/print_disk_info.c 2018-05-11 12:10:46.000000000 +0300
+++ i3status-2.12.mod/src/print_disk_info.c 2018-06-21 19:33:34.403580664 +0300
@@ -144,7 +144,7 @@
char *sanitized = sstrdup(path);
if (strlen(sanitized) > 1 && sanitized[strlen(sanitized) - 1] == '/')
sanitized[strlen(sanitized) - 1] = '\0';
- FILE *mntentfile = setmntent("/etc/mtab", "r");
+ FILE *mntentfile = setmntent("/proc/self/mounts", "r");
struct mntent *m;
while ((m = getmntent(mntentfile)) != NULL) {

View File

@ -0,0 +1,40 @@
diff -uNr i3status-2.13/Makefile.am i3status-2.13.mod/Makefile.am
--- i3status-2.13/Makefile.am 2019-02-21 16:35:12.000000000 +0200
+++ i3status-2.13.mod/Makefile.am 2019-07-19 02:20:40.232423055 +0300
@@ -29,7 +29,6 @@
$(YAJL_CFLAGS) \
$(PULSE_CFLAGS) \
$(NLGENL_CFLAGS) \
- $(ALSA_CFLAGS) \
$(PTHREAD_CFLAGS)
i3status_CPPFLAGS = \
@@ -41,7 +40,6 @@
$(YAJL_LIBS) \
$(PULSE_LIBS) \
$(NLGENL_LIBS) \
- $(ALSA_LIBS) \
$(PTHREAD_LIBS)
i3status_SOURCES = \
@@ -52,20 +50,16 @@
src/first_network_device.c \
src/general.c \
src/output.c \
- src/print_battery_info.c \
src/print_cpu_temperature.c \
src/print_cpu_usage.c \
src/print_ddate.c \
src/print_disk_info.c \
- src/print_eth_info.c \
src/print_ip_addr.c \
src/print_ipv6_addr.c \
- src/print_load.c \
src/print_mem.c \
src/print_path_exists.c \
src/print_run_watch.c \
src/print_time.c \
- src/print_volume.c \
src/print_wireless_info.c \
src/print_file_contents.c \
src/process_runs.c \

View File

@ -0,0 +1,20 @@
diff -uNr i3status-2.13/configure.ac i3status-2.13.mod/configure.ac
--- i3status-2.13/configure.ac 2019-06-30 20:53:24.000000000 +0300
+++ i3status-2.13.mod/configure.ac 2019-07-19 02:18:04.275231603 +0300
@@ -73,7 +73,7 @@
AC_SEARCH_LIBS([floor], [m], , [AC_MSG_FAILURE([cannot find the required floor() function despite trying to link with -lm])])
-AC_SEARCH_LIBS([shm_open], [rt])
+AC_SEARCH_LIBS([glob], [android-glob])
AC_CANONICAL_HOST
@@ -83,7 +83,6 @@
case $host_os in
linux*)
PKG_CHECK_MODULES([NLGENL], [libnl-genl-3.0])
- PKG_CHECK_MODULES([ALSA], [alsa])
PKG_CHECK_MODULES([PULSE], [libpulse])
;;
netbsd*)

View File

@ -1,7 +1,24 @@
diff -uNr i3status-2.12/i3status.c i3status-2.12.mod/i3status.c
--- i3status-2.12/i3status.c 2018-05-11 12:10:46.000000000 +0300
+++ i3status-2.12.mod/i3status.c 2018-06-21 19:33:34.400247331 +0300
@@ -363,26 +363,6 @@
diff -uNr i3status-2.13/i3status.c i3status-2.13.mod/i3status.c
--- i3status-2.13/i3status.c 2019-02-21 16:35:12.000000000 +0200
+++ i3status-2.13.mod/i3status.c 2019-07-19 02:34:38.188689039 +0300
@@ -346,16 +346,6 @@
CFG_CUSTOM_SEP_BLOCK_WIDTH_OPT,
CFG_END()};
- cfg_opt_t ethernet_opts[] = {
- CFG_STR("format_up", "E: %ip (%speed)", CFGF_NONE),
- CFG_STR("format_down", "E: down", CFGF_NONE),
- CFG_CUSTOM_ALIGN_OPT,
- CFG_CUSTOM_COLOR_OPTS,
- CFG_CUSTOM_MIN_WIDTH_OPT,
- CFG_CUSTOM_SEPARATOR_OPT,
- CFG_CUSTOM_SEP_BLOCK_WIDTH_OPT,
- CFG_END()};
-
cfg_opt_t ipv6_opts[] = {
CFG_STR("format_up", "%ip", CFGF_NONE),
CFG_STR("format_down", "no IPv6", CFGF_NONE),
@@ -366,26 +356,6 @@
CFG_CUSTOM_SEP_BLOCK_WIDTH_OPT,
CFG_END()};
@ -17,7 +34,7 @@ diff -uNr i3status-2.12/i3status.c i3status-2.12.mod/i3status.c
- CFG_STR("threshold_type", "time", CFGF_NONE),
- CFG_BOOL("last_full_capacity", false, CFGF_NONE),
- CFG_BOOL("integer_battery_capacity", false, CFGF_NONE),
- CFG_BOOL("hide_seconds", false, CFGF_NONE),
- CFG_BOOL("hide_seconds", true, CFGF_NONE),
- CFG_CUSTOM_ALIGN_OPT,
- CFG_CUSTOM_COLOR_OPTS,
- CFG_CUSTOM_MIN_WIDTH_OPT,
@ -28,7 +45,7 @@ diff -uNr i3status-2.12/i3status.c i3status-2.12.mod/i3status.c
cfg_opt_t time_opts[] = {
CFG_STR("format", "%Y-%m-%d %H:%M:%S", CFGF_NONE),
CFG_CUSTOM_ALIGN_OPT,
@@ -410,17 +390,6 @@
@@ -414,17 +384,6 @@
CFG_CUSTOM_SEP_BLOCK_WIDTH_OPT,
CFG_END()};
@ -43,10 +60,10 @@ diff -uNr i3status-2.12/i3status.c i3status-2.12.mod/i3status.c
- CFG_CUSTOM_SEP_BLOCK_WIDTH_OPT,
- CFG_END()};
-
cfg_opt_t usage_opts[] = {
CFG_STR("format", "%usage", CFGF_NONE),
CFG_STR("format_above_threshold", NULL, CFGF_NONE),
@@ -461,19 +430,6 @@
cfg_opt_t memory_opts[] = {
CFG_STR("format", "%used %free %available", CFGF_NONE),
CFG_STR("format_degraded", NULL, CFGF_NONE),
@@ -478,19 +437,6 @@
CFG_CUSTOM_SEP_BLOCK_WIDTH_OPT,
CFG_END()};
@ -63,13 +80,14 @@ diff -uNr i3status-2.12/i3status.c i3status-2.12.mod/i3status.c
- CFG_CUSTOM_SEP_BLOCK_WIDTH_OPT,
- CFG_END()};
-
cfg_opt_t opts[] = {
CFG_STR_LIST("order", "{}", CFGF_NONE),
CFG_SEC("general", general_opts, CFGF_NONE),
@@ -481,15 +437,12 @@
cfg_opt_t read_opts[] = {
CFG_STR("format", "%content", CFGF_NONE),
CFG_STR("format_bad", "%title - %errno: %error", CFGF_NONE),
@@ -509,16 +455,12 @@
CFG_SEC("run_watch", run_watch_opts, CFGF_TITLE | CFGF_MULTI),
CFG_SEC("path_exists", path_exists_opts, CFGF_TITLE | CFGF_MULTI),
CFG_SEC("wireless", wireless_opts, CFGF_TITLE | CFGF_MULTI),
CFG_SEC("ethernet", ethernet_opts, CFGF_TITLE | CFGF_MULTI),
- CFG_SEC("ethernet", ethernet_opts, CFGF_TITLE | CFGF_MULTI),
- CFG_SEC("battery", battery_opts, CFGF_TITLE | CFGF_MULTI),
CFG_SEC("cpu_temperature", temp_opts, CFGF_TITLE | CFGF_MULTI),
CFG_SEC("disk", disk_opts, CFGF_TITLE | CFGF_MULTI),
@ -79,13 +97,24 @@ diff -uNr i3status-2.12/i3status.c i3status-2.12.mod/i3status.c
CFG_SEC("tztime", tztime_opts, CFGF_TITLE | CFGF_MULTI),
CFG_SEC("ddate", ddate_opts, CFGF_NONE),
- CFG_SEC("load", load_opts, CFGF_NONE),
CFG_SEC("memory", memory_opts, CFGF_NONE),
CFG_SEC("cpu_usage", usage_opts, CFGF_NONE),
CFG_END()};
@@ -694,12 +647,6 @@
CFG_SEC("read_file", read_opts, CFGF_TITLE | CFGF_MULTI),
@@ -714,23 +656,6 @@
SEC_CLOSE_MAP;
}
- CASE_SEC_TITLE("ethernet") {
- SEC_OPEN_MAP("ethernet");
- const char *interface = NULL;
- if (strcasecmp(title, "_first_") == 0)
- interface = first_eth_interface(NET_TYPE_ETHERNET);
- if (interface == NULL)
- interface = title;
- print_eth_info(json_gen, buffer, interface, cfg_getstr(sec, "format_up"), cfg_getstr(sec, "format_down"));
- SEC_CLOSE_MAP;
- }
-
- CASE_SEC_TITLE("battery") {
- SEC_OPEN_MAP("battery");
- print_battery_info(json_gen, buffer, (strcasecmp(title, "all") == 0 ? -1 : atoi(title)), cfg_getstr(sec, "path"), cfg_getstr(sec, "format"), cfg_getstr(sec, "format_down"), cfg_getstr(sec, "status_chr"), cfg_getstr(sec, "status_bat"), cfg_getstr(sec, "status_unk"), cfg_getstr(sec, "status_full"), cfg_getint(sec, "low_threshold"), cfg_getstr(sec, "threshold_type"), cfg_getbool(sec, "last_full_capacity"), cfg_getbool(sec, "integer_battery_capacity"), cfg_getbool(sec, "hide_seconds"));
@ -95,7 +124,7 @@ diff -uNr i3status-2.12/i3status.c i3status-2.12.mod/i3status.c
CASE_SEC_TITLE("run_watch") {
SEC_OPEN_MAP("run_watch");
print_run_watch(json_gen, buffer, title, cfg_getstr(sec, "pidfile"), cfg_getstr(sec, "format"), cfg_getstr(sec, "format_down"));
@@ -718,12 +665,6 @@
@@ -749,12 +674,6 @@
SEC_CLOSE_MAP;
}
@ -105,10 +134,10 @@ diff -uNr i3status-2.12/i3status.c i3status-2.12.mod/i3status.c
- SEC_CLOSE_MAP;
- }
-
CASE_SEC("time") {
SEC_OPEN_MAP("time");
print_time(json_gen, buffer, NULL, cfg_getstr(sec, "format"), NULL, NULL, NULL, tv.tv_sec);
@@ -742,16 +683,6 @@
CASE_SEC("memory") {
SEC_OPEN_MAP("memory");
print_memory(json_gen, buffer, cfg_getstr(sec, "format"), cfg_getstr(sec, "format_degraded"), cfg_getstr(sec, "threshold_degraded"), cfg_getstr(sec, "threshold_critical"), cfg_getstr(sec, "memory_used_method"));
@@ -779,16 +698,6 @@
SEC_CLOSE_MAP;
}

View File

@ -0,0 +1,43 @@
diff -uNr i3status-2.13/i3status.conf i3status-2.13.mod/i3status.conf
--- i3status-2.13/i3status.conf 2019-02-09 18:13:25.000000000 +0200
+++ i3status-2.13.mod/i3status.conf 2019-07-19 02:04:01.159446241 +0300
@@ -11,37 +11,13 @@
interval = 5
}
-order += "ipv6"
-order += "wireless _first_"
-order += "ethernet _first_"
-order += "battery all"
-order += "disk /"
-order += "load"
-order += "memory"
+order += "disk /data"
order += "tztime local"
-wireless _first_ {
- format_up = "W: (%quality at %essid) %ip"
- format_down = "W: down"
-}
-
-ethernet _first_ {
- format_up = "E: %ip (%speed)"
- format_down = "E: down"
-}
-
-battery all {
- format = "%status %percentage %remaining"
-}
-
-disk "/" {
+disk "/data" {
format = "%avail"
}
-load {
- format = "%1min"
-}
-
memory {
format = "%used | %available"
threshold_degraded = "1G"

View File

@ -1,20 +1,22 @@
diff -uNr i3status-2.12/include/i3status.h i3status-2.12.mod/include/i3status.h
--- i3status-2.12/include/i3status.h 2018-05-11 12:10:46.000000000 +0300
+++ i3status-2.12.mod/include/i3status.h 2018-06-21 19:33:34.403580664 +0300
@@ -212,7 +212,6 @@
diff -uNr i3status-2.13/include/i3status.h i3status-2.13.mod/include/i3status.h
--- i3status-2.13/include/i3status.h 2019-02-21 16:35:12.000000000 +0200
+++ i3status-2.13.mod/include/i3status.h 2019-07-19 02:34:05.475239331 +0300
@@ -214,7 +214,6 @@
void print_ipv6_info(yajl_gen json_gen, char *buffer, const char *format_up, const char *format_down);
void print_disk_info(yajl_gen json_gen, char *buffer, const char *path, const char *format, const char *format_below_threshold, const char *format_not_mounted, const char *prefix_type, const char *threshold_type, const double low_threshold);
-void print_battery_info(yajl_gen json_gen, char *buffer, int number, const char *path, const char *format, const char *format_down, const char *status_chr, const char *status_bat, const char *status_unk, const char *status_full, int low_threshold, char *threshold_type, bool last_full_capacity, bool integer_battery_capacity, bool hide_seconds);
void print_time(yajl_gen json_gen, char *buffer, const char *title, const char *format, const char *tz, const char *locale, const char *format_time, time_t t);
void print_time(yajl_gen json_gen, char *buffer, const char *title, const char *format, const char *tz, const char *locale, const char *format_time, bool hide_if_equals_localtime, time_t t);
void print_ddate(yajl_gen json_gen, char *buffer, const char *format, time_t t);
const char *get_ip_addr(const char *interface, int family);
@@ -222,8 +221,6 @@
@@ -223,10 +222,7 @@
void print_path_exists(yajl_gen json_gen, char *buffer, const char *title, const char *path, const char *format, const char *format_down);
void print_cpu_temperature_info(yajl_gen json_gen, char *buffer, int zone, const char *path, const char *format, const char *format_above_threshold, int);
void print_cpu_usage(yajl_gen json_gen, char *buffer, const char *format, const char *format_above_threshold, const char *format_above_degraded_threshold, const char *path, const float max_threshold, const float degraded_threshold);
void print_eth_info(yajl_gen json_gen, char *buffer, const char *interface, const char *format_up, const char *format_down);
-void print_eth_info(yajl_gen json_gen, char *buffer, const char *interface, const char *format_up, const char *format_down);
-void print_load(yajl_gen json_gen, char *buffer, const char *format, const char *format_above_threshold, const float max_threshold);
void print_memory(yajl_gen json_gen, char *buffer, const char *format, const char *format_degraded, const char *threshold_degraded, const char *threshold_critical, const char *memory_used_method);
-void print_volume(yajl_gen json_gen, char *buffer, const char *fmt, const char *fmt_muted, const char *device, const char *mixer, int mixer_idx);
bool process_runs(const char *path);
int volume_pulseaudio(uint32_t sink_idx, const char *sink_name);
bool pulse_initialize(void);
bool description_pulseaudio(uint32_t sink_idx, const char *sink_name, char buffer[MAX_SINK_DESCRIPTION_LEN]);

View File

@ -0,0 +1,16 @@
diff -uNr i3status-2.13/src/print_disk_info.c i3status-2.13.mod/src/print_disk_info.c
--- i3status-2.13/src/print_disk_info.c 2019-01-23 10:03:56.000000000 +0200
+++ i3status-2.13.mod/src/print_disk_info.c 2019-07-19 01:56:23.384608234 +0300
@@ -147,10 +147,10 @@
sanitized[strlen(sanitized) - 1] = '\0';
FILE *mntentfile = setmntent("/etc/mtab", "r");
if (mntentfile == NULL) {
- mntentfile = setmntent("/proc/mounts", "r");
+ mntentfile = setmntent("/proc/self/mounts", "r");
}
if (mntentfile == NULL) {
- fprintf(stderr, "i3status: files /etc/mtab and /proc/mounts aren't accessible\n");
+ fprintf(stderr, "i3status: files /etc/mtab and /proc/self/mounts aren't accessible\n");
} else {
struct mntent *m;