Adding item to the menu (GNOME)

thedogfarted thedogfarted at inbox.lv
Thu Mar 11 21:59:19 UTC 2004


Someone should write a script in redhat-config-* style that does all the 
stuff described in this thread, like fedora-config-menus :)

Kurt Sabathy wrote:

> 
> Hey,
> 
> I 've recorded my mini-howto in managing panel menus/submenus manually:
> 
>  How-To Add a Submenu To The Default Folder Structure
>    ====================================================
>    
>    This sample assume that we want to add two sub-menus 'StarOffice 7' and
>    'Docu & Admin' to the 'Office' menu in the default Main Menu on the panel.
>    These enhancements should be for a local user only.
>    
>    The OpSystem is Fedora Cora 1, custom installation with all pkg's.
> 
>    Tree of the 'Main Menu' in the default Panel  with nodes / submenu's
>    only (no launcher-obj):
> 
>    Tree: Application         # root/main menu-icon on the panel
>    snip:  
>  |   .....          # tip-text = Main Menu
>  |-- Internet
>  |    
>  |-- Office                            # 1st submenu
>  |    |__ More Office Applications     # sub-submenu
>  |    |
>  |    |__ StarOffice 7               < < NEW sub-submenu
>  |        ^^^^^^^|^^^^
>  |               |__ Docu & Admin    < < NEW sub-sub-submenu
>  |-- Other           ^^^^^^^^^^^^
>  |   ......
>           
>           
>    (1) Edit File "applications.menu"
>        ----------------------------
>        Add the new sub-folder/sub-menu to the applications.menu file i.e.
>        the the definition file of the whole Menu Structure:
>    
>        ° make a backup copy of the file to edit.
>        
>        ° as ROOT edit file '/etc/X11/desktop-menus/applications.menu'
>        
>          - if deciding a local enhancement only, you must set the path
>            to the *.desktop files at the begining of this menu file add:
>            
>               <!-- Local for User=xyz  -->
>               <MergeDir>/home/ksa/.gnome/apps/StarOffice-7</MergeDir>
>        
>          - carefully search the folder 'Office'; 
>            Note: the folder's <Name> is a script-variable and may be something
>                  different.
>            <Folder>                         # begin folder 'Office'
>  |     <Name>myOffice</Name>
>  -     . . .
>  |     <Query>
>  -        .....
>  |     </Query>
>  -                                  # folder 'More Office ...
>  |     <Folder>
>  v     |    <Name>MoreMyOffice</Name
>  |    +       ...
>  -     |    <DontShowIfEmpty/>
>  |     </Folder>
>  -
>  |     ^^^^    -     <Folder> - begin 'StarOffice 7'
>  -     ^^^^    |         <Name>StarOffice7</Name>
>  |                        <Desktop>StarOffice7.directory</Desktop>
>  -              |          <Query>
>  |                              <Keyword>Application</Keyword>
>  -              |               <Keyword>sOffice-7</Keyword>
>  |                       </Query>
>  -  >  insert here:    < -  <Folder>  
>  |                              |      <Name>DocAdmin</Name>
>  -              |               *     <Desktop>StarOffice7-DocuAdmin</Desktop>
>  |                              |      <Query>
>  -              |               *          <Keyword>sOffice7-Doc</Keyword>
>  |                              |      </Query>
>  -              |               *     <DontShowIfEmpty/>
>  |                              -  </Folder>
>  -              |         <DontShowIfEmpty/>
>  |      vvvv   -     </Folder> - end   'StarOffice 7' 
>  -      vvvv
>  |     <DontShowIfEmpty/>
>  </Folder>                        # end folder 'Office' 
> 
> 
> e.g. for 'Docu & Admin' folder we define:
>            
> <Folder>               # begin 'StarOffice 7'
>      . . . . . 
>      <!-- More StarOffice 7  -->            # comment
>      <Folder>                               # start submenu item
>      <Name>DocAdmin</Name>              # folder script variable
>      <Desktop>StarOffice7-DocuAdmin</Desktop> # *.directory file
>      <Query>   ^^^^^^^^^^^^^^^^^^^^                          
>           <Keyword>sOffice7-Doc</Keyword> # Categories in *.desktop
>      </Query>         ^^^^^^^^^^^^
>      <DontShowIfEmpty/>
>      </Folder>                              # end submenu
>              
>      <DontShowIfEmpty/>
> </Folder>              # end 'StarOffice 7'
> 
>        ° save file
>        
> 
> 
>    (2) Edit The *.directory Files
>        ----------------------------
>        Edit for every sub-menu a file [name].directory, where [name] is
>        the defined name in tag <Desktop>StarOffice7-DocuAdmin</Desktop> of
>        the previous changed 'applications.menu' file.
>        For locally use save it to a user dir and create a symLink in the pre-
>        defined global subdirectory '/usr/share/desktop-menu-files/'.
>        
>        ° as <USER> create local directory e.g.
>             $ mkdir ~/.gnome/apps/menu-files
>             $ cd    ~/.gnome/apps/menu-files
>        ° create a NEW file [name].directory:
>             $ [edit] ./StarOffice7-DocuAdmin.directory   # any meaningful name
>             
>                  [Desktop Entry]
>                  Type=Directory
>                  Name=Docu & Admin             # you see THIS name in the
>                  Name[de]=Doku + Admin         # panel sub-sub-menu
>                  Name[fr]=.....
>                  Icon=/home/<user>/.gnome/apps/StarOffice-7/icons/folder.png
>                  Terminal=0
>          
>        ° as ROOT create symbolic Link in global *.directory dir to local dir:
>             $ su
>             $ cd /usr/share/desktop-menu-files
>             $ ln -s /home/<user>/.gnome/apps/   \
>                      menu-files/StarOffice7-DocuAdmin.directory  \
>                       ./StarOffice7-DocuAdmin.directory
>        
> 
> 
>    (3) Edit The *.desktop Files
>        ----------------------------
>        Edit for every launcher-object you want in this sub-submenu a file
>        [name].desktop, where the file-name is free.
>        For locally use save they also to an user dir [searchpath] as defined
>        in the applications-menu file:
>             <MergeDir>/home/ksa/.gnome/apps/StarOffice-7</MergeDir>
>                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>        ° as <USER> create local directory e.g.
>             $ mkdir ~/.gnome/apps/StarOffice-7
>             $ cd    ~/.gnome/apps/StarOffice-7
>        ° If NO Launcher Object exist:
>          create a NEW file [name].directory; name can be any meaningful token
>          because system search is done only by inspcting 'Categories'.
>             $ [edit] ./StarOffice7-DocuAdmin.directory   # any meaningful name
>        
>                  Name=Docu & Admin             # you see THIS name in the
>                  Name[de]=Doku + Admin         # panel sub-sub-menu
>                  Name[fr]=.....                # in French
>                  Comment=Applications          # tip-text
>                  Comment[da]=Programmer        # in french -> locale
>                  Comment[de]=Anwendungen       # in german
>                  Terminal=false                # run not in a terminal
>                  Icon=/home/<user>/.gnome/apps/StarOffice-7/icons/draw.png
>                  Exec=/home/<user>/opt/appl/staroffice7/program/sdraw
>                  Type=Application                  
>                  Categories=Application;sOffice-7;
>                                            ^-- see file applications.menu
>                                                <Keyword>sOffice7-Doc</Keyword>
>                                                
>        ° If a launcher-obj / *.desktop file exist:
>          If you have a *.desktop of your application, or if you created a
>          launcher-obj with your GUI (creates also a *.desktop file)
>          you have to check and edit:
>          - path of 'Icon' + 'Exec' attributes
>          - 'Categories' is your Keyword token (file applications.menu)
>             included
> 
> I hope that help others a bit.
> 
> Kurt
> 
> 





More information about the users mailing list