Re: Script for creating Application Menu



Hi all,

hmmmm... Well. I've changed the syntax (Menu:Entry:Command)

But, if the menu-file is:

Office:Abiword:abiword
Office:Abiword2:abiword

... I'll get two submenus called Office. Well, my rep-nowledge is not
enough for this, so could someone else complete it? Would be nice ^_^

Thanks in advance,
Chris

Am Montag, den 27.07.2009, 21:17 +0200 schrieb Christopher Roy Bratusek:
> Hi all,
> 
> I made a basic bash-script for creating a desktop menu based on the
> stuff from /usr/share/applications/*.desktop. simply run the script, it
> will then give you more infos :)
> 
> ... This script is bash-only and gnu-sed-only. Maybe someone may improve
> it. 
> 
> Also the original dynamic-menu.jl does not support Menu-entry names with
> spaces in it, I've fixed that. Ideally it would support a third string,
> which opens a Submenu ... Currently there's only one level, that's not
> optimal.
> 
> Enjoy your new menu :)
> Chris

(defun read-menu (filename)
	"dynamic menu"
  (setq src-file (open-file filename 'read))
  (setq res '())
  (while (setq line (read-line src-file))
    (if (string-match "^([a-zA-Z0-9\_\ ]+):([a-zA-Z0-9\_\ ]+):([a-zA-Z0-9\_\.\"\ \/-]+)\n$" line)
	(let ((menu (substring line (match-start 1) (match-end 1)))
	      (entry (substring line (match-start 2) (match-end 2)))
	      (prog (substring line (match-start 3) (match-end 3))))
	  (setq res
		(cons `(,menu (,entry (system ,(concat prog " &"))))
		      res)))))
  (reverse res))



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