Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/scripts/list-outputs.c
blob: f2c3f0bc3529ad1399203286ccbc8a4585db0ff2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <stdio.h>
#include <X11/extensions/Xrandr.h>

int main(int argc, char **argv)
{
    Display *dpy = XOpenDisplay(NULL);
    XRRScreenResources *rr;
    XRROutputInfo *output;
    int i;

    XSynchronize(dpy, 1);

    rr = XRRGetScreenResources(dpy, DefaultRootWindow(dpy));

    for (i = 0; i < rr->noutput; i++) {
	    output = XRRGetOutputInfo(dpy, rr, rr->outputs[i]);

        if (output->connection == RR_Connected) {
            printf("%s\n", output->name);
        }

        XRRFreeOutputInfo(output);
    }

    XRRFreeScreenResources(rr);

    XSync(dpy, 1);
    XCloseDisplay(dpy);

    return 0;
}