<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Jan 24, 2015 at 10:50 AM, Jim Rees <span dir="ltr"><<a href="mailto:rees@umich.edu" target="_blank">rees@umich.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Here is a patch I have found useful. It puts the client list menu in<br>
alphabetical order. To finish this, you would have to make it configurable,<br>
and also do the non-combined menu.<br>
<br>
From: Jim Rees <<a href="mailto:rees@umich.edu">rees@umich.edu</a>><br>
Date: Sat, 24 Jan 2015 13:39:18 -0500<br>
Subject: [PATCH 6/6] put client-list-combined-menu in alphabetical order<br>
<br>
Signed-off-by: Jim Rees <<a href="mailto:rees@umich.edu">rees@umich.edu</a>><br>
---<br>
 openbox/client_list_combined_menu.c | 11 ++++++++++-<br>
 1 file changed, 10 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/openbox/client_list_combined_menu.c b/openbox/client_list_combined_menu.c<br>
index c26b6fa..2a3e083 100644<br>
--- a/openbox/client_list_combined_menu.c<br>
+++ b/openbox/client_list_combined_menu.c<br>
@@ -42,6 +42,13 @@ static void self_cleanup(ObMenu *menu, gpointer data)<br>
     menu_clear_entries(menu);<br>
 }<br>
<br>
+static gint<br>
+compfunc(gconstpointer a, gconstpointer b)<br>
+{<br>
+    ObClient *c1 = (ObClient *) a, *c2 = (ObClient *) b;<br>
+    return strcmp(c1->title, c2->title);<br>
+}<br>
+<br>
 static gboolean self_update(ObMenuFrame *frame, gpointer data)<br>
 {<br>
     ObMenu *menu = frame->menu;<br>
@@ -55,8 +62,10 @@ static gboolean self_update(ObMenuFrame *frame, gpointer data)<br>
         gboolean empty = TRUE;<br>
         gboolean onlyiconic = TRUE;<br>
<br>
+        it = g_list_sort(g_list_copy(focus_order), compfunc);<br></blockquote><div><br></div><div>You need a matching g_list_free to avoid a memory leak, right?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
         menu_add_separator(menu, SEPARATOR, screen_desktop_names[desktop]);<br>
-        for (it = focus_order; it; it = g_list_next(it)) {<br>
+        for (; it; it = g_list_next(it)) {<br>
             ObClient *c = it->data;<br>
             if (focus_valid_target(c, desktop,<br>
                                    TRUE, TRUE,<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.2.2<br>
_______________________________________________<br>
openbox mailing list<br>
<a href="mailto:openbox@icculus.org">openbox@icculus.org</a><br>
<a href="http://icculus.org/mailman/listinfo/openbox" target="_blank">http://icculus.org/mailman/listinfo/openbox</a><br>
</font></span></blockquote></div><br></div></div>