Introduction
Introduction Statistics Contact Development Disclaimer Help
minor code-style - seturgent - set urgency hints for X applications
git clone git://git.codemadness.org/seturgent
Log
Files
Refs
README
LICENSE
---
commit 6235d5d2ab554da35f2279469415b46f1694f67a
parent f9e26acb42177e81964993ccfcd62a62e724cf3c
Author: Hiltjo Posthuma <[email protected]>
Date: Sat, 13 May 2017 13:53:43 +0200
minor code-style
Diffstat:
M seturgent.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
---
diff --git a/seturgent.c b/seturgent.c
@@ -7,47 +7,52 @@
#include <X11/Xutil.h>
static void
-die(const char *s) {
+die(const char *s)
+{
fputs(s, stderr);
exit(EXIT_FAILURE);
}
static int
-seturgency(Display *dpy, Window winid, Bool set) {
+seturgency(Display *dpy, Window winid, Bool set)
+{
int ret = EXIT_SUCCESS;
XWMHints *hints = XGetWMHints(dpy, winid);
- if(!hints) {
+ if (!hints) {
fputs("seturgent: unable to get window manager hints.\n", stde…
return EXIT_FAILURE;
}
- if(set)
+ if (set)
hints->flags |= XUrgencyHint;
else
hints->flags &= ~XUrgencyHint;
- if(!XSetWMHints(dpy, winid, hints)) {
+ if (!XSetWMHints(dpy, winid, hints)) {
fputs("seturgent: unable to set urgency hint.\n", stderr);
ret = EXIT_FAILURE;
}
XFree(hints);
+
return ret;
}
int
-main(int argc, char **argv) {
+main(int argc, char **argv)
+{
Display *dpy;
int ret = EXIT_SUCCESS;
- if(argc < 2 || !strcmp(argv[1], "-h")) /* help / usage */
+ if (argc < 2 || !strcmp(argv[1], "-h")) /* help / usage */
die("Usage: seturgent <winid> [0|1]\n");
- if(argc == 2 && !strcmp(argv[1], "-v")) /* version */
+ if (argc == 2 && !strcmp(argv[1], "-v")) /* version */
die("seturgent-"VERSION" © 2010-2017 seturgent engineer, see …
"LICENSE file for details.\n");
- if(!(dpy = XOpenDisplay(NULL)))
+ if (!(dpy = XOpenDisplay(NULL)))
die("seturgent: unable to open display.\n");
/* set the urgency hint (or not), if not specified its True. */
ret = seturgency(dpy, (Window)strtol(argv[1], NULL, 0),
!((argc > 2) && !atol(argv[2])));
XSync(dpy, False);
XCloseDisplay(dpy);
+
return ret;
}
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.