]>
git.gir.st - xvisbell.git/blob - xvisbell.c
1 /* briefly flashes a fullscreen white window to simulate a visual bell */
2 #define _DEFAULT_SOURCE
6 int main (int argc
, char** argv
) {
10 unsigned long bgcolor
= 0xffffff;
12 /* parse command line arguments for 3bit colors */
13 if (argc
> 1) switch(argv
[1][0]) {
14 case 'r': bgcolor
= 0xff0000; break;
15 case 'g': bgcolor
= 0x00ff00; break;
16 case 'b': bgcolor
= 0x0000ff; break;
17 case 'c': bgcolor
= 0x00ffff; break;
18 case 'm': bgcolor
= 0xff00ff; break;
19 case 'y': bgcolor
= 0xffff00; break;
20 case 'k': bgcolor
= 0x000000; break;
21 case 'w': bgcolor
= 0xffffff; break;
24 display
= XOpenDisplay(NULL
);
26 /* indirectly aquire display resolution through root window's size*/
27 XGetWindowAttributes(display
, XDefaultRootWindow(display
), &xwa
);
29 window
= XCreateSimpleWindow (display
, XDefaultRootWindow(display
),
30 0, 0, /* position left/top */
31 xwa
.width
, xwa
.height
,
32 0, 0, /* border settings */
35 Atom wdialog
= XInternAtom (display
, "_NET_WM_WINDOW_TYPE_DIALOG", 1);
36 XChangeProperty (display
, window
,
37 XInternAtom (display
, "_NET_WM_WINDOW_TYPE", 1),
38 XInternAtom (display
, "ATOM", 1),
39 32, PropModeReplace
, (unsigned char *) &wdialog
, 1);
42 XMapWindow(display
,window
);