Re: [i3] tray_output for primary display

2012-03-20 Thread José Luis Pereira
Dear Michael, All

Here you have the patch that implements the primary output feature. Its
 working fairly well, could you add it also in the docs?
Also, user should be aware that the is no default primary display (at least
in my debian machine), you can make it by doing so:
xrandr --output output_display --primary


Looking forward to contribute with more patches.
Best Regards
--
José Pereira

On Sun, Mar 18, 2012 at 5:09 PM, Michael Stapelberg mich...@i3wm.orgwrote:

 Hi José,

 Excerpts from José Luis Pereira's message of 2012-03-18 14:34:43 +0100:
  Thanks for your anwer. I would like to implement the feature, i have
 fairly
 Awesome!

  good C knowledge for this. Would you give me some guidelines?
  I have been looking into the code and i found out that the modification
  should be in xbc.c on i3bar source, am i right?
 Yes, partly:

 Since i3bar uses IPC and doesn’t query RandR directly, I recommend
 introducing
 a new boolean member in the IPC reply for the get_outputs message (see
 i3-msg
 -t get_outputs), called primary. Then, make i3bar handle primary as a
 special value (case-insensitively) in i3bar/src/xcb.c.

 Feel free to send patches to this mailing list for review and feel free to
 drop
 by on IRC to clarify any questions you might have.

 Best regards,
 Michael

diff --git a/i3bar/include/outputs.h b/i3bar/include/outputs.h
index 6501c31..cb336be 100644
--- a/i3bar/include/outputs.h
+++ b/i3bar/include/outputs.h
@@ -40,6 +40,7 @@ i3_output* get_output_by_name(char* name);
 struct i3_output {
 char*  name;  /* Name of the output */
 bool   active;/* If the output is active */
+bool   primary;   /* If it is the primary output */ 
 intws;/* The number of the currently visible ws */
 rect   rect;  /* The rect (relative to the root-win) */
 
diff --git a/i3bar/src/outputs.c b/i3bar/src/outputs.c
index 9dc5cab..83a4c24 100644
--- a/i3bar/src/outputs.c
+++ b/i3bar/src/outputs.c
@@ -45,15 +45,19 @@ static int outputs_null_cb(void *params_) {
 static int outputs_boolean_cb(void *params_, int val) {
 struct outputs_json_params *params = (struct outputs_json_params*) params_;
 
-if (strcmp(params-cur_key, active)) {
-return 0;
+if (!strcmp(params-cur_key, active)) {
+params-outputs_walk-active = val;
+FREE(params-cur_key);
+return 1;
 }
 
-params-outputs_walk-active = val;
-
-FREE(params-cur_key);
+if (!strcmp(params-cur_key, primary)) {
+params-outputs_walk-primary = val;
+FREE(params-cur_key);
+return 1;
+}
 
-return 1;
+return 0;
 }
 
 /*
diff --git a/i3bar/src/xcb.c b/i3bar/src/xcb.c
index 29ffe1c..3615603 100644
--- a/i3bar/src/xcb.c
+++ b/i3bar/src/xcb.c
@@ -452,9 +452,12 @@ static void handle_client_message(xcb_client_message_event_t* event) {
 SLIST_FOREACH(walk, outputs, slist) {
 if (!walk-active)
 continue;
-if (config.tray_output 
-strcasecmp(walk-name, config.tray_output) != 0)
-continue;
+if (config.tray_output) {
+if ((strcasecmp(walk-name, config.tray_output) != 0) 
+(strcasecmp(primary, config.tray_output) != 0 || !walk-primary))
+continue;
+}
+
 DLOG(using output %s\n, walk-name);
 output = walk;
 }
diff --git a/src/ipc.c b/src/ipc.c
index fe1464e..60533da 100644
--- a/src/ipc.c
+++ b/src/ipc.c
@@ -408,6 +408,9 @@ IPC_HANDLER(get_outputs) {
 ystr(active);
 y(bool, output-active);
 
+ystr(primary);
+y(bool, output-primary);
+
 ystr(rect);
 y(map_open);
 ystr(x);


[i3] EWMH for panels

2012-03-20 Thread Alexander Corvinus
from i3 User’s Guide:
 Regardless of which application you use to display the status line, you want 
 to make sure that it registers as a dock window using EWMH hints. i3 will 
 position the window either at the top or at the bottom of the screen, 
 depending on which hint the application sets.

Can you please elaborate, which hints need to be set? Can they be set
in something like devilspie? I feel it will remain a relevant question
for quite some time. Even dzen2's stable release currently can't set
them on its own, so panel overlaps windows or other content.


Re: [i3] EWMH for panels

2012-03-20 Thread Axel Wagner
Hi,

Excerpts from Alexander Corvinus's message of 2012-03-20 15:21:17 +0100:
 Can you please elaborate, which hints need to be set?

You need to set the window-type to _NET_WM_WINDOW_TYPE_DOCK and set the
_NET_WM_STRUT_PARTIAL property, which basically says how much space you
want and where you want to be placed.
You can find an example of both in i3bar/src/xcb.c:1241 resp.
i3bar/src/xcb.c:1283.
Furthor information about _NET_WM_STRUT_PARTIAL is provided in the EWMH-spec [1]

 Can they be set in something like devilspie?

I looked at [2] and there does not seem to exist an action to set STRUT
or STRUT_PARTIAL, but you can set the window-type. Oddly there appears
to be no way to set arbitrary EWMH-properties, which I find pretty
unflexible…
I don't know from the top of my head, what i3 does, when you request to be
docking but don't set STRUT_PARTIAL. Iirc it used to put the window at the
top of the screen.

 Even dzen2's stable release currently can't set
 them on its own, so panel overlaps windows or other content.

This is only because the developer of dzen2 hasn't done a stable release
in years. The code exists in the svn-repository for quite some time ;)

Regards,

Axel

[1] http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#id2578550
[2] http://www.foosel.org/linux/devilspie#actions


signature.asc
Description: PGP signature


Re: [i3] tray_output for primary display

2012-03-20 Thread Fernando Lemos
Hi,

2012/3/20 José Luis Pereira ona...@gmail.com:
 Dear Michael, All

 Here you have the patch that implements the primary output feature. Its
  working fairly well, could you add it also in the docs?
 Also, user should be aware that the is no default primary display (at least
 in my debian machine), you can make it by doing so:
 xrandr --output output_display --primary

Looks good, though I didn't test it. Some very minor suggestions, feel
free to ignore them to your discretion:

* I'd prefer to do the boolean comparison first in the if clause.
There's no performance improvement in practice, but it seems more
correct to me.

* You've added a trailing whitespace to i3bar/outputs.h.

If you can, please submit a patch for the docs. They're in the same
Git repository. I believe you may choose to use send a different
patch, or simply pack the changes in the same commit (specially as the
changes should be simple enough).

Regards,