Merge branch 'idle' into next
Conflicts: config.def.h config.mk dunst.c
This commit is contained in:
commit
f662e65011
@ -11,7 +11,7 @@ XINERAMAFLAGS = -DXINERAMA
|
|||||||
|
|
||||||
# includes and libs
|
# includes and libs
|
||||||
INCS = -I${X11INC} -I/usr/lib/dbus-1.0/include -I/usr/include/dbus-1.0
|
INCS = -I${X11INC} -I/usr/lib/dbus-1.0/include -I/usr/include/dbus-1.0
|
||||||
LIBS = -L${X11LIB} -lX11 -ldbus-1 -lpthread -lrt -liniparser ${XINERAMALIBS}
|
LIBS = -L${X11LIB} -lX11 -lXext -lXss -ldbus-1 -lpthread -lrt -liniparser ${XINERAMALIBS}
|
||||||
|
|
||||||
# flags
|
# flags
|
||||||
CPPFLAGS = -D_BSD_SOURCE -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
|
CPPFLAGS = -D_BSD_SOURCE -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
|
||||||
|
21
dunst.c
21
dunst.c
@ -13,6 +13,7 @@
|
|||||||
#ifdef XINERAMA
|
#ifdef XINERAMA
|
||||||
#include <X11/extensions/Xinerama.h>
|
#include <X11/extensions/Xinerama.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <X11/extensions/scrnsaver.h>
|
||||||
|
|
||||||
#include <iniparser.h>
|
#include <iniparser.h>
|
||||||
|
|
||||||
@ -52,6 +53,7 @@ int sort = True; /* sort messages by urgency */
|
|||||||
int indicate_hidden = True; /* show count of hidden messages */
|
int indicate_hidden = True; /* show count of hidden messages */
|
||||||
char *key_string = NULL;
|
char *key_string = NULL;
|
||||||
KeySym mask = 0;
|
KeySym mask = 0;
|
||||||
|
int idle_threshold = 0;
|
||||||
|
|
||||||
int verbosity = 0;
|
int verbosity = 0;
|
||||||
|
|
||||||
@ -68,6 +70,7 @@ static int visible = False;
|
|||||||
static KeySym key = NoSymbol;
|
static KeySym key = NoSymbol;
|
||||||
static screen_info scr;
|
static screen_info scr;
|
||||||
static dimension_t geometry;
|
static dimension_t geometry;
|
||||||
|
static XScreenSaverInfo *screensaver_info;
|
||||||
static int font_h;
|
static int font_h;
|
||||||
static char *config_file;
|
static char *config_file;
|
||||||
|
|
||||||
@ -90,6 +93,7 @@ void handle_mouse_click(XEvent ev);
|
|||||||
void handleXEvents(void);
|
void handleXEvents(void);
|
||||||
void initmsg(msg_queue_t *msg);
|
void initmsg(msg_queue_t *msg);
|
||||||
rule_t *initrule(void);
|
rule_t *initrule(void);
|
||||||
|
int is_idle(void);
|
||||||
char *string_replace(const char *needle, const char *replacement, char *haystack);
|
char *string_replace(const char *needle, const char *replacement, char *haystack);
|
||||||
void run(void);
|
void run(void);
|
||||||
void setup(void);
|
void setup(void);
|
||||||
@ -232,6 +236,11 @@ check_timeouts(void) {
|
|||||||
|
|
||||||
cur = msgqueue;
|
cur = msgqueue;
|
||||||
while(cur != NULL) {
|
while(cur != NULL) {
|
||||||
|
if(is_idle()) {
|
||||||
|
cur->start = now;
|
||||||
|
cur = cur->next;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if(cur->start == 0 || cur->timeout == 0) {
|
if(cur->start == 0 || cur->timeout == 0) {
|
||||||
cur = cur->next;
|
cur = cur->next;
|
||||||
continue;
|
continue;
|
||||||
@ -554,6 +563,17 @@ initrule(void) {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
is_idle(void)
|
||||||
|
{
|
||||||
|
XScreenSaverQueryInfo(dc->dpy, DefaultRootWindow(dc->dpy),
|
||||||
|
screensaver_info);
|
||||||
|
if(idle_threshold == 0) {
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
return screensaver_info->idle / 1000 > idle_threshold;
|
||||||
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
string_replace(const char *needle, const char *replacement, char *haystack) {
|
string_replace(const char *needle, const char *replacement, char *haystack) {
|
||||||
char *tmp, *start;
|
char *tmp, *start;
|
||||||
@ -980,6 +1000,7 @@ main(int argc, char *argv[]) {
|
|||||||
parse_dunstrc();
|
parse_dunstrc();
|
||||||
parse_cmdline(argc, argv);
|
parse_cmdline(argc, argv);
|
||||||
key = key_string ? XStringToKeysym(key_string) : NoSymbol;
|
key = key_string ? XStringToKeysym(key_string) : NoSymbol;
|
||||||
|
screensaver_info = XScreenSaverAllocInfo();
|
||||||
|
|
||||||
initdbus();
|
initdbus();
|
||||||
initfont(dc, font);
|
initfont(dc, font);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user