diff options
-rw-r--r-- | .travis.yml | 6 | ||||
-rw-r--r-- | I3STATUS_VERSION | 1 | ||||
-rw-r--r-- | Makefile | 16 | ||||
-rw-r--r-- | VERSION | 1 | ||||
-rw-r--r-- | i3status.c | 23 | ||||
-rw-r--r-- | man/i3status.man | 11 | ||||
-rw-r--r-- | src/print_wireless_info.c | 4 | ||||
-rw-r--r-- | src/pulse.c | 11 |
8 files changed, 46 insertions, 27 deletions
diff --git a/.travis.yml b/.travis.yml index 4fdfa5e..2f3f93d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,5 @@ +sudo: required +dist: trusty language: c compiler: - gcc @@ -5,10 +7,6 @@ compiler: addons: # See http://docs.travis-ci.com/user/apt/ apt: - sources: - - llvm-toolchain-precise-3.5 - # ubuntu-toolchain-r-test contains libstdc++6 >= 4.8 which libllvm3.5 needs. - - ubuntu-toolchain-r-test packages: - libconfuse-dev - libyajl-dev diff --git a/I3STATUS_VERSION b/I3STATUS_VERSION new file mode 100644 index 0000000..8eedd74 --- /dev/null +++ b/I3STATUS_VERSION @@ -0,0 +1 @@ +2.10-non-git @@ -1,3 +1,5 @@ +TOPDIR=$(shell pwd) + ifndef PREFIX PREFIX=/usr endif @@ -17,7 +19,7 @@ CFLAGS+=-g CFLAGS+=-std=gnu99 CFLAGS+=-pedantic CPPFLAGS+=-DSYSCONFDIR=\"$(SYSCONFDIR)\" -CPPFLAGS+=-DVERSION=\"${GIT_VERSION}\" +CPPFLAGS+=-DVERSION=\"${I3STATUS_VERSION}\" CFLAGS+=-Iinclude LIBS+=-lconfuse LIBS+=-lyajl @@ -25,8 +27,14 @@ LIBS+=-lpulse LIBS+=-lm LIBS+=-lpthread -VERSION:=$(shell git describe --tags --abbrev=0) -GIT_VERSION:="$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1))" +ifeq ($(wildcard .git),) + # not in git repository + VERSION := '$(shell [ -f $(TOPDIR)/VERSION ] && cat $(TOPDIR)/VERSION)' + I3STATUS_VERSION := '$(shell [ -f $(TOPDIR)/I3STATUS_VERSION ] && cat $(TOPDIR)/I3STATUS_VERSION)' +else + VERSION:=$(shell git describe --tags --abbrev=0) + I3STATUS_VERSION:="$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1))" +endif OS:=$(shell uname) ifeq ($(OS),Linux) @@ -120,6 +128,6 @@ release: cp -r include i3status-${VERSION} cp -r yajl-fallback i3status-${VERSION} cp -r contrib i3status-${VERSION} - sed -e 's/^GIT_VERSION:=\(.*\)/GIT_VERSION=${GIT_VERSION}/g;s/^VERSION:=\(.*\)/VERSION=${VERSION}/g' Makefile > i3status-${VERSION}/Makefile + sed -e 's/^I3STATUS_VERSION:=\(.*\)/I3STATUS_VERSION=${I3STATUS_VERSION}/g;s/^VERSION:=\(.*\)/VERSION=${VERSION}/g' Makefile > i3status-${VERSION}/Makefile tar cjf i3status-${VERSION}.tar.bz2 i3status-${VERSION} rm -rf i3status-${VERSION} @@ -0,0 +1 @@ +2.10 @@ -229,12 +229,7 @@ static char *resolve_tilde(const char *path) { static char *get_config_path(void) { char *xdg_config_home, *xdg_config_dirs, *config_path; - /* 1: check the traditional path under the home directory */ - config_path = resolve_tilde("~/.i3status.conf"); - if (path_exists(config_path)) - return config_path; - - /* 2: check for $XDG_CONFIG_HOME/i3status/config */ + /* 1: check for $XDG_CONFIG_HOME/i3status/config */ if ((xdg_config_home = getenv("XDG_CONFIG_HOME")) == NULL) xdg_config_home = "~/.config"; @@ -247,15 +242,14 @@ static char *get_config_path(void) { return config_path; free(config_path); - /* 3: check the traditional path under /etc */ - config_path = SYSCONFDIR "/i3status.conf"; - if (path_exists(config_path)) - return sstrdup(config_path); - - /* 4: check for $XDG_CONFIG_DIRS/i3status/config */ + /* 2: check for $XDG_CONFIG_DIRS/i3status/config */ if ((xdg_config_dirs = getenv("XDG_CONFIG_DIRS")) == NULL) xdg_config_dirs = "/etc/xdg"; + /* 3: check the traditional path under the home directory */ + config_path = resolve_tilde("~/.i3status.conf"); + if (path_exists(config_path)) + return config_path; char *buf = strdup(xdg_config_dirs); char *tok = strtok(buf, ":"); while (tok != NULL) { @@ -272,6 +266,11 @@ static char *get_config_path(void) { } free(buf); + /* 4: check the traditional path under /etc */ + config_path = SYSCONFDIR "/i3status.conf"; + if (path_exists(config_path)) + return sstrdup(config_path); + die("Unable to find the configuration file (looked at " "~/.i3status.conf, $XDG_CONFIG_HOME/i3status/config, " "/etc/i3status.conf and $XDG_CONFIG_DIRS/i3status/config)"); diff --git a/man/i3status.man b/man/i3status.man index a557ae3..32bc6e6 100644 --- a/man/i3status.man +++ b/man/i3status.man @@ -17,10 +17,10 @@ i3status [-c configfile] [-h] [-v] Specifies an alternate configuration file path. By default, i3status looks for configuration files in the following order: -1. ~/.i3status.conf -2. ~/.config/i3status/config (or $XDG_CONFIG_HOME/i3status/config if set) -3. /etc/i3status.conf -4. /etc/xdg/i3status/config (or $XDG_CONFIG_DIRS/i3status/config if set) +1. ~/.config/i3status/config (or $XDG_CONFIG_HOME/i3status/config if set) +2. /etc/xdg/i3status/config (or $XDG_CONFIG_DIRS/i3status/config if set) +3. ~/.i3status.conf +4. /etc/i3status.conf == DESCRIPTION @@ -446,9 +446,10 @@ If you would like to use markup in this section, there is a separate *Example configuration (markup)*: ------------------------------------------------------------- -tztime time { +tztime berlin { format = "<span foreground='#ffffff'>time:</span> %time" format_time = "%H:%M %Z" + timezone = "Europe/Berlin" } ------------------------------------------------------------- diff --git a/src/print_wireless_info.c b/src/print_wireless_info.c index 4f92507..25e167f 100644 --- a/src/print_wireless_info.c +++ b/src/print_wireless_info.c @@ -15,6 +15,10 @@ #define IW_ESSID_MAX_SIZE 32 #endif +#ifdef __APPLE__ +#define IW_ESSID_MAX_SIZE 32 +#endif + #ifdef __FreeBSD__ #include <sys/param.h> #include <sys/ioctl.h> diff --git a/src/pulse.c b/src/pulse.c index f9ed5d3..3398014 100644 --- a/src/pulse.c +++ b/src/pulse.c @@ -20,6 +20,7 @@ static pa_threaded_mainloop *main_loop = NULL; static pa_context *context = NULL; static pa_mainloop_api *api = NULL; static bool context_ready = false; +static bool mainloop_thread_running = false; static uint32_t default_sink_idx = DEFAULT_SINK_INDEX; TAILQ_HEAD(tailhead, indexed_volume_s) cached_volume = TAILQ_HEAD_INITIALIZER(cached_volume); @@ -152,6 +153,7 @@ static void context_state_callback(pa_context *c, void *userdata) { case PA_CONTEXT_SETTING_NAME: case PA_CONTEXT_TERMINATED: default: + context_ready = false; break; case PA_CONTEXT_READY: { @@ -169,7 +171,10 @@ static void context_state_callback(pa_context *c, void *userdata) { } break; case PA_CONTEXT_FAILED: - pulseaudio_error_log(c); + /* server disconnected us, attempt to reconnect */ + context_ready = false; + pa_context_unref(context); + context = NULL; break; } } @@ -235,12 +240,14 @@ bool pulse_initialize(void) { pulseaudio_error_log(context); return false; } - if (pa_threaded_mainloop_start(main_loop) < 0) { + if (!mainloop_thread_running && + pa_threaded_mainloop_start(main_loop) < 0) { pulseaudio_error_log(context); pa_threaded_mainloop_free(main_loop); main_loop = NULL; return false; } + mainloop_thread_running = true; } return true; } |