Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/commands/helpers/list-outputs.c
diff options
context:
space:
mode:
authorDaniel Narvaez <dwnarvaez@gmail.com>2012-11-16 09:53:35 (GMT)
committer Daniel Narvaez <dwnarvaez@gmail.com>2012-11-16 09:53:35 (GMT)
commit61765e0aaae479b94a3fddd01e4e12eae76bb8da (patch)
tree4c00c5555c77d70db6bd8cae2768d365d12c6702 /commands/helpers/list-outputs.c
parent76d6fad87094008bc25e3b4e090fb79631414fec (diff)
Move the remaining scripts to commands
Diffstat (limited to 'commands/helpers/list-outputs.c')
-rw-r--r--commands/helpers/list-outputs.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/commands/helpers/list-outputs.c b/commands/helpers/list-outputs.c
new file mode 100644
index 0000000..183258c
--- /dev/null
+++ b/commands/helpers/list-outputs.c
@@ -0,0 +1,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;
+}