Re: put client-list-combined-menu in alphabetical order
Dana Jansens <[email protected]>
| Newsgroups | gmane.comp.window-managers.openbox |
|---|---|
| Message-ID | <CAP1a_adi0hYU40-O63Bwn5JoDFcjbuQ987hSWYtyXZEow0M-=g@mail.gmail.com> |
On Sat, Jan 24, 2015 at 10:50 AM, Jim Rees <[email protected]> wrote: > Here is a patch I have found useful. It puts the client list menu in > alphabetical order. To finish this, you would have to make it configurable, > and also do the non-combined menu. > > 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 | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/openbox/client_list_combined_menu.c > b/openbox/client_list_combined_menu.c > index c26b6fa..2a3e083 100644 > --- a/openbox/client_list_combined_menu.c > +++ b/openbox/client_list_combined_menu.c > @@ -42,6 +42,13 @@ 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; > @@ -55,8 +62,10 @@ static gboolean self_update(ObMenuFrame *frame, > gpointer data) > gboolean empty = TRUE; > gboolean onlyiconic = TRUE; > > + it = g_list_sort(g_list_copy(focus_order), compfunc); > You need a matching g_list_free to avoid a memory leak, right? > + > menu_add_separator(menu, SEPARATOR, > screen_desktop_names[desktop]); > - for (it = focus_order; it; it = g_list_next(it)) { > + for (; it; it = g_list_next(it)) { > ObClient *c = it->data; > if (focus_valid_target(c, desktop, > TRUE, TRUE, > -- > 2.2.2 > _______________________________________________ > openbox mailing list > [email protected] > http://icculus.org/mailman/listinfo/openbox > _______________________________________________ openbox mailing list [email protected] http://icculus.org/mailman/listinfo/openbox