DPMSの設定機能性を追加
このコミットが含まれているのは:
コミット
ea12c6abdc
3
config.h
3
config.h
|
@ -41,6 +41,7 @@ static unsigned int gappih = 5; /* horiz inner gap between windows */
|
|||
static unsigned int gappiv = 5; /* vert inner gap between windows */
|
||||
static unsigned int gappoh = 5; /* horiz outer gap between windows and screen edge */
|
||||
static unsigned int gappov = 5; /* vert outer gap between windows and screen edge */
|
||||
static unsigned int dpms = -1; /* 分間。DPMSを無効にする場合:-1 */
|
||||
static int swallowfloating = 0; /* 1 means swallow floating windows by default */
|
||||
static int smartgaps = 0; /* 1 means no outer gap when there is only one window */
|
||||
static int showbar = 1; /* 0 means no bar */
|
||||
|
@ -76,8 +77,6 @@ static Sp scratchpads[] = {
|
|||
|
||||
static const char *const autostart[] = {
|
||||
"hsetroot", "-center", bgimg, NULL,
|
||||
"xset", "-dpms", NULL,
|
||||
"xset", "s", "off", NULL,
|
||||
NULL /* terminate */
|
||||
};
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ endif
|
|||
|
||||
# includes and libs
|
||||
INCS = -I${X11INC} -I${FREETYPEINC}
|
||||
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lX11-xcb -lxcb -lxcb-res
|
||||
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lX11-xcb -lxcb -lxcb-res -lXext
|
||||
ifeq ($(OS),FreeBSD)
|
||||
LIBS += -lutil
|
||||
endif
|
||||
|
|
28
dwm.c
28
dwm.c
|
@ -47,6 +47,7 @@
|
|||
#ifdef XINERAMA
|
||||
#include <X11/extensions/Xinerama.h>
|
||||
#endif /* XINERAMA */
|
||||
#include <X11/extensions/dpms.h>
|
||||
#include <X11/Xft/Xft.h>
|
||||
#include <X11/Xlib-xcb.h>
|
||||
#include <xcb/res.h>
|
||||
|
@ -197,6 +198,7 @@ typedef struct {
|
|||
} ResourcePref;
|
||||
|
||||
/* function declarations */
|
||||
static void setdpms();
|
||||
static void setupbackgrounds();
|
||||
static void applyrules(Client *c);
|
||||
static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact);
|
||||
|
@ -396,6 +398,31 @@ static size_t autostart_len;
|
|||
/* 背景を設定 */
|
||||
char bgimg[100];
|
||||
|
||||
void setdpms() {
|
||||
Display *display;
|
||||
int dummy;
|
||||
|
||||
display = XOpenDisplay(NULL);
|
||||
if (!display) {
|
||||
fprintf(stderr, "Xディスプレイを見つけられません。");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!DPMSQueryExtension(display, &dummy, &dummy)) {
|
||||
fprintf(stderr, "DPMSが対応していません。");
|
||||
return;
|
||||
}
|
||||
|
||||
DPMSEnable(display);
|
||||
|
||||
if (dpms == -1) {
|
||||
DPMSDisable(display);
|
||||
}
|
||||
|
||||
XSetScreenSaver(display, dpms, 0, DefaultBlanking, DefaultExposures);
|
||||
XCloseDisplay(display);
|
||||
}
|
||||
|
||||
void setupbackgrounds() {
|
||||
strcpy(bgimg, wallpaper);
|
||||
strcat(bgimg, resolution);
|
||||
|
@ -2788,6 +2815,7 @@ main(int argc, char *argv[])
|
|||
if (!(xcon = XGetXCBConnection(dpy)))
|
||||
die("dwm: cannot get xcb connection\n");
|
||||
checkotherwm();
|
||||
setdpms();
|
||||
setupbackgrounds();
|
||||
autostart_exec();
|
||||
XrmInitialize();
|
||||
|
|
読み込み中…
新しいイシューから参照