]> git.sur5r.net Git - i3/i3/commitdiff
ipc: fix current_workspace
authorMichael Stapelberg <michael@stapelberg.de>
Sun, 21 Nov 2010 21:12:34 +0000 (22:12 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Sun, 21 Nov 2010 21:12:34 +0000 (22:12 +0100)
include/data.h
src/ipc.c
src/tree.c

index c7fcb4a5cc9bcfbf3420109a73fa6d9b3c5f3e95..97d479488532fbcb13ef16a380a9ddd35b5626ff 100644 (file)
@@ -186,6 +186,9 @@ struct xoutput {
     /** Name of the output */
     char *name;
 
+    /** Pointer to the Con which represents this output */
+    Con *con;
+
     /** Whether the output is currently active (has a CRTC attached with a
      * valid mode) */
     bool active;
index 7e76ace5b87c89dba255c537788a3f3e37ec7076..40b6a71269fb6f91b07c5e02bce33383959b2298 100644 (file)
--- a/src/ipc.c
+++ b/src/ipc.c
@@ -343,13 +343,11 @@ IPC_HANDLER(get_outputs) {
         y(integer, output->rect.height);
         y(map_close);
 
-        /*
-         * XXX
-         * No idea how to handle this, where should we get this data from?
-         * I think we might need to keep a reference to the CT_OUTPUT Con in Output
-         */
         ystr("current_workspace");
-        y(null);
+        Con *ws = NULL;
+        if (output->con && (ws = con_get_fullscreen_con(output->con)))
+            ystr(ws->name);
+        else y(null);
 
         y(map_close);
     }
index 734406b3daf74f12f6bf542a9398913cba7333f0..f9f10d59b44cd55070ef0c246e9d821aff752fc1 100644 (file)
@@ -69,6 +69,7 @@ void tree_init() {
         oc->name = strdup(output->name);
         oc->type = CT_OUTPUT;
         oc->rect = output->rect;
+        output->con = oc;
 
         char *name;
         asprintf(&name, "[i3 con] output %s", oc->name);