Re: Client list wish

Jim Rees <[email protected]>
Newsgroups gmane.comp.window-managers.openbox
Message-ID <[email protected]>
I do wish the client list menu was more configurable. The MRU order doesn't
seem very useful. Here's my patch, which puts them in alphabetical
order. It's not what you asked for but might help someone.

From a63468a671892468dd8bc5116bce7fcac676aacb Mon Sep 17 00:00:00 2001
From: Jim Rees <[email protected]>
Date: Sat, 24 Jan 2015 13:39:18 -0500
Subject: [PATCH 6/6] put client-list-combined-menu in alphabetical order

Signed-off-by: Jim Rees <[email protected]>
---
 openbox/client_list_combined_menu.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/openbox/client_list_combined_menu.c b/openbox/client_list_combined_menu.c
index c26b6fa..3c51f14 100644
--- a/openbox/client_list_combined_menu.c
+++ b/openbox/client_list_combined_menu.c
@@ -42,11 +42,18 @@ static void self_cleanup(ObMenu *menu, gpointer data)
     menu_clear_entries(menu);
 }
 
+static gint
+compfunc(gconstpointer a, gconstpointer b)
+{
+    ObClient *c1 = (ObClient *) a, *c2 = (ObClient *) b;
+    return strcmp(c1->title, c2->title);
+}
+
 static gboolean self_update(ObMenuFrame *frame, gpointer data)
 {
     ObMenu *menu = frame->menu;
     ObMenuEntry *e;
-    GList *it;
+    GList *it, *sorted_it;
     guint desktop;
 
     menu_clear_entries(menu);
@@ -55,8 +62,10 @@ static gboolean self_update(ObMenuFrame *frame, gpointer data)
         gboolean empty = TRUE;
         gboolean onlyiconic = TRUE;
 
+        sorted_it = g_list_sort(g_list_copy(focus_order), compfunc);
+
         menu_add_separator(menu, SEPARATOR, screen_desktop_names[desktop]);
-        for (it = focus_order; it; it = g_list_next(it)) {
+        for (it = sorted_it; it; it = g_list_next(it)) {
             ObClient *c = it->data;
             if (focus_valid_target(c, desktop,
                                    TRUE, TRUE,
@@ -83,6 +92,7 @@ static gboolean self_update(ObMenuFrame *frame, gpointer data)
                 e->data.normal.data = c;
             }
         }
+        g_list_free(sorted_it);
 
         if (empty || onlyiconic) {
             /* no entries or only iconified windows, so add a
-- 
2.2.2
_______________________________________________
openbox mailing list
[email protected]
http://icculus.org/mailman/listinfo/openbox
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.