Don't unnecessarily call alarm when duration is zero
This commit is contained in:
parent
e43bdb67a6
commit
30b0961b2e
4 changed files with 10 additions and 3 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
herbe
|
||||
.ccls-cache
|
||||
|
|
4
TODO.md
Normal file
4
TODO.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
* Handle multiple notifications at the same time
|
||||
* Properly handle duration = 0
|
||||
* Keyboard shortcut to dismiss and accept notifications (also mouse)
|
||||
* Properly print new lines
|
2
config.h
2
config.h
|
@ -13,4 +13,4 @@ static const unsigned int pos_y = 60;
|
|||
enum corners { TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT };
|
||||
enum corners corner = TOP_RIGHT;
|
||||
|
||||
static const unsigned int duration = 5; /* in seconds */
|
||||
static const unsigned int duration = 5; /* in seconds */
|
||||
|
|
6
herbe.c
6
herbe.c
|
@ -67,7 +67,9 @@ int main(int argc, char *argv[])
|
|||
die("Usage: %s body", argv[0]);
|
||||
|
||||
signal(SIGALRM, expire);
|
||||
alarm(duration);
|
||||
|
||||
if (duration != 0)
|
||||
alarm(duration);
|
||||
|
||||
display = XOpenDisplay(0);
|
||||
|
||||
|
@ -165,4 +167,4 @@ int main(int argc, char *argv[])
|
|||
XCloseDisplay(display);
|
||||
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue