herbe

[fork] notifications
Log | Files | Refs | README | LICENSE

commit 30b0961b2e0b8187289ec7b9b038a344a85b0171
parent e43bdb67a6c954f8f0304f93db07f42bc8f59038
Author: Samuel Dudik <samuel.dudik@gmail.com>
Date:   Thu, 13 Aug 2020 17:37:40 +0200

Don't unnecessarily call alarm when duration is zero

Diffstat:
M.gitignore | 1+
ATODO.md | 4++++
Mconfig.h | 3+--
Mherbe.c | 7++++---
4 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -1 +1,2 @@ herbe +.ccls-cache diff --git a/TODO.md b/TODO.md @@ -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 diff --git a/config.h b/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 */ -\ No newline at end of file +static const unsigned int duration = 5; /* in seconds */ diff --git a/herbe.c b/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); -} -\ No newline at end of file +}