Load desktop entry files(*.desktop) and show them in an application menu for launching commands
- py-configparser: parsing desktop entry file
- FiveAM: test framework (optional)
if you are using Quicklisp, then in the REPL:
(ql:quickload :py-configparser)
(ql:quickload :FiveAM)
- Load module
(load-module "desktop-entry")
- Initialize
*entry-list*
with the*entry-paths*
(desktop-entry:init-entry-list)
- Add show-desktop-menu command to your keybindings, e.g.:
(define-key *root-map* (kbd "m") "show-desktop-menu")
- The
*entry-paths*
is defined as below, you can change the value of it before initialization
(defvar *entry-paths*
'(#P"/usr/share/applications"
#P"~/.local/share/applications"))
- Specify other entry-paths
(desktop-entry:init-entry-list [entry paths])
- Add an entry to entry-list
(desktop-entry:add-to-entry-list
desktop-entry:*entry-list*
#P"xxx.desktop")
(desktop-entry:add-to-entry-list
desktop-entry:*entry-list*
(desktop-entry:make-desktop-entry #P"xxx.desktop"))
(desktop-entry:add-to-entry-list
desktop-entry:*entry-list*
(desktop-entry:make-desktop-entry
'(:name "Google Chrome"
:entry-type "Application"
:exec "/usr/bin/google-chrome-stable %U"
:path nil
:categories ("Network" "WebBrowser")
:no-display nil
:only-show-in nil
:terminal nil)))
- Add favorite
(desktop-entry:add-favorite-entry <instance of desktop-entry>)
(desktop-entry:add-favorite-entry <name of an entry in *entry-list*>)
(desktop-entry:add-favorite-entry <pathname of a desktop file>)