Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/scripts/list-outputs.c
blob: 183258c2654e6d48fa40c87f923fd597b2561790 (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
32
33
#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));

    if (rr != NULL) {
        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;
}