Re: [Patch] apps-menu filtering



Matthew Love <matth love gmail com> writes:

> Ok, I think I have this working as you explain, see patch (to current
> diff).
>
> The desktop entries are now split after being associated with the
> category list and before being processed by user/default filters.
> Filters will still act as if there is only one entry, though the
> 'Category' key can now be used, which will contain one of the categories
> from the original entry.  The menu is set using the 'Category' key from the
> entry, so this can be changed to change the name of the categories that
> show up in the menu.
> fdo-check-exile is now run on the output of the user filter, so any
> entries that get Name/Exec/Categories removed will end up exiled.

Looks good.  Now I can do this to rename the "Utility" submenu:

(defun myfilter (ent)
  (let ((ent (fdo-default-filter ent)))
    (when ent
      (let ((cat (cdr (assoc "Category" ent)))
        (cond ((string= "Utility" cat)
               (rplacd (assoc "Category" ent) "util")))
        ent))))
(setq apps-menu-associate-categories nil)
(setq apps-menu-filter myfilter)

However, this leads to duplicate entries, since emacs shows up in
multiple categories and they all get switched to "util".

(defun myfilter (ent)
  (let ((ent (fdo-default-filter ent)))
    (when ent
      (let ((cat (cdr (assoc "Category" ent))))
        (cond ((string-match "emacs" (cdr (assoc "Name" ent)) nil t)
               (rplacd (assoc "Category" ent) "util")))
        ent))))

-- 
Jeremy Hankins <nowan nowan org>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]