Introduction
Introduction Statistics Contact Development Disclaimer Help
on failure use error status code - seturgent - set urgency hints for X applicat…
git clone git://git.codemadness.org/seturgent
Log
Files
Refs
README
LICENSE
---
commit b17caf6ce32d347bede7f589cfdb892e3de5633a
parent 6700e19d19994f1c6926ff5ce246f3d54496bd22
Author: Hiltjo Posthuma <[email protected]>
Date: Sat, 13 May 2017 13:52:33 +0200
on failure use error status code
Diffstat:
M seturgent.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/seturgent.c b/seturgent.c
@@ -12,37 +12,42 @@ die(const char *s) {
exit(EXIT_FAILURE);
}
-static void
+static int
seturgency(Display *dpy, Window winid, Bool set) {
+ int ret = EXIT_SUCCESS;
XWMHints *hints = XGetWMHints(dpy, winid);
if(!hints) {
fputs("seturgent: unable to get window manager hints.\n", stde…
- return;
+ return EXIT_FAILURE;
}
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) {
Display *dpy;
+ int ret = EXIT_SUCCESS;
if(argc < 2 || !strcmp(argv[1], "-h")) /* help / usage */
die("Usage: seturgent <winid> [0|1]\n");
if(argc == 2 && !strcmp(argv[1], "-v")) /* version */
- die("seturgent-"VERSION" © 2010-2012 seturgent engineer, see …
+ die("seturgent-"VERSION" © 2010-2017 seturgent engineer, see …
"LICENSE file for details.\n");
if(!(dpy = XOpenDisplay(NULL)))
die("seturgent: unable to open display.\n");
/* set the urgency hint (or not), if not specified its True. */
- seturgency(dpy, (Window)strtol(argv[1], NULL, 0),
+ ret = seturgency(dpy, (Window)strtol(argv[1], NULL, 0),
!((argc > 2) && !atol(argv[2])));
XSync(dpy, False);
XCloseDisplay(dpy);
- return EXIT_SUCCESS;
+ 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.