summaryrefslogtreecommitdiff
path: root/i3status.c
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2012-12-05 17:47:29 +0100
committerMichael Stapelberg <michael@stapelberg.de>2012-12-05 17:49:54 +0100
commit0a608d4af67fe59390f2e8931f61b664f48660db (patch)
tree89a7577bdf57512f1ab2313af9f7eb8d483b5c37 /i3status.c
parent0eeded8bc013857a5e8a2efbc20002a22502897e (diff)
make SIGUSR1 do nothing, so that killall -USR1 i3status will force an update
Sending SIGUSR1 will interrupt the nanosleep() and thus force a new iteration of i3status’s output loop. The signal handler itself is empty. Based on the question by ttjjss at http://faq.i3wm.org/question/854/how-to-force-status-bar-update/
Diffstat (limited to 'i3status.c')
-rw-r--r--i3status.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/i3status.c b/i3status.c
index 503f763..87a793b 100644
--- a/i3status.c
+++ b/i3status.c
@@ -58,6 +58,14 @@ void sigpipe(int signum) {
}
/*
+ * Do nothing upon SIGUSR1. Running this signal handler will nevertheless
+ * interrupt nanosleep() so that i3status immediately generates new output.
+ *
+ */
+void sigusr1(int signum) {
+}
+
+/*
* Checks if the given path exists by calling stat().
*
*/
@@ -305,6 +313,10 @@ int main(int argc, char *argv[]) {
action.sa_handler = sigpipe;
sigaction(SIGPIPE, &action, NULL);
+ memset(&action, 0, sizeof(struct sigaction));
+ action.sa_handler = sigusr1;
+ sigaction(SIGUSR1, &action, NULL);
+
if (setlocale(LC_ALL, "") == NULL)
die("Could not set locale. Please make sure all your LC_* / LANG settings are correct.");