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/
This commit is contained in:
parent
0eeded8bc0
commit
0a608d4af6
12
i3status.c
12
i3status.c
@ -57,6 +57,14 @@ void sigpipe(int signum) {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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().
|
* Checks if the given path exists by calling stat().
|
||||||
*
|
*
|
||||||
@ -305,6 +313,10 @@ int main(int argc, char *argv[]) {
|
|||||||
action.sa_handler = sigpipe;
|
action.sa_handler = sigpipe;
|
||||||
sigaction(SIGPIPE, &action, NULL);
|
sigaction(SIGPIPE, &action, NULL);
|
||||||
|
|
||||||
|
memset(&action, 0, sizeof(struct sigaction));
|
||||||
|
action.sa_handler = sigusr1;
|
||||||
|
sigaction(SIGUSR1, &action, NULL);
|
||||||
|
|
||||||
if (setlocale(LC_ALL, "") == NULL)
|
if (setlocale(LC_ALL, "") == NULL)
|
||||||
die("Could not set locale. Please make sure all your LC_* / LANG settings are correct.");
|
die("Could not set locale. Please make sure all your LC_* / LANG settings are correct.");
|
||||||
|
|
||||||
|
@ -378,6 +378,12 @@ Note that if you want to use the JSON output format (with colors in i3bar), you
|
|||||||
need to use a slightly more complex wrapper script. There are examples in the
|
need to use a slightly more complex wrapper script. There are examples in the
|
||||||
contrib/ folder, see http://code.i3wm.org/i3status/tree/contrib
|
contrib/ folder, see http://code.i3wm.org/i3status/tree/contrib
|
||||||
|
|
||||||
|
== SIGNALS
|
||||||
|
|
||||||
|
When receiving +SIGUSR1+, i3status’s nanosleep() will be interrupted and thus
|
||||||
|
you will force an update. You can use killall -USR1 i3status to force an update
|
||||||
|
after changing the system volume, for example.
|
||||||
|
|
||||||
== SEE ALSO
|
== SEE ALSO
|
||||||
|
|
||||||
+strftime(3)+, +date(1)+, +glob(3)+, +dzen2(1)+, +xmobar(1)+
|
+strftime(3)+, +date(1)+, +glob(3)+, +dzen2(1)+, +xmobar(1)+
|
||||||
|
Loading…
Reference in New Issue
Block a user