Results 1 to 2 of 2

Thread: Using classic menus with gnome-shell ...

  1. #1

    Default Using classic menus with gnome-shell ...

    Tree menus are not supported under gnome-shell, but you can reformat your legacy (tree) menu into a flat menu that would include and show all directories (just not in a tree form). Here's a xslt script that might help:
    Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    	xmlns:func="http://exslt.org/functions"
    	extension-element-prefixes="func">
    
    <xsl:output method="text" disable-output-escaping="yes" encoding="utf-8"/>
    <xsl:decimal-format decimal-separator="." grouping-separator=","/>
    
    <xsl:template match="/">
    &lt;!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
     "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd"&gt;
    &lt;Menu&gt;
    
      &lt;Name&gt;Applications&lt;/Name&gt;
      &lt;Directory&gt;X-GNOME-Menu-Applications.directory&lt;/Directory&gt;
    
      &lt;!-- Scan legacy dirs first, as later items take priority --&gt;
      &lt;KDELegacyDirs/&gt;
      &lt;LegacyDir&gt;/etc/X11/applnk&lt;/LegacyDir&gt;
      &lt;LegacyDir&gt;/usr/share/gnome/apps&lt;/LegacyDir&gt;
    
      &lt;!-- Read standard .directory and .desktop file locations --&gt;
      &lt;DefaultAppDirs/&gt;
      &lt;DefaultDirectoryDirs/&gt;
    
      &lt;!-- Read in overrides and child menus from applications-merged/ --&gt;
      &lt;DefaultMergeDirs/&gt;
    <xsl:for-each select="//Menu"><xsl:call-template name="submenu"/></xsl:for-each>
      &lt;Layout&gt;
         &lt;Merge type="menus" /&gt;
         &lt;Menuname&gt;Other&lt;/Menuname&gt;
         &lt;Merge type="files" /&gt;
       &lt;/Layout&gt;
    &lt;/Menu&gt;
    </xsl:template>
    
    <xsl:template name="submenu">
    <xsl:variable name="category" select="Include/Category"/>
    <xsl:if test="$category != ''">
      &lt;Menu&gt;
        &lt;Name&gt;<xsl:value-of select="translate(Name,'-',':')"/>&lt;/Name&gt;
        &lt;Include&gt;
          &lt;And&gt;
             &lt;Category&gt;<xsl:copy-of select="$category"/>&lt;/Category&gt;
          &lt;/And&gt;
        &lt;/Include&gt;
      &lt;/Menu&gt;
    </xsl:if>
    </xsl:template>
    </xsl:stylesheet>
    You need to install the package libxslt-tools, which includes the xslt processor (xsltproc).
    Save this script as the file /etc/xdg/menus/gnome-menuclassic.xslt, apply it to your legacy menu (if you wrote one), otherwise to /etc/xdg/menus/applications.menu and redirect the output to /etc/xdg/menus/gnome-shell-applications.menu

    Code:
    # cd /etc/xdg/menus
    # xsltproc gnome-menuclassic.xslt applications.menu 2>/dev/null > gnome-shell-applications.menu
    Be aware that Gnome uses /etc/xdg/menus/gnome-applications.menu by default. Thus, to use the tree menu (which still works fine in fallbak mode). you'll have to modify XDG_MENU_PREFIX (which defaults to "gnome-").

    In your X init script, set XDG_MENU_PREFIX to an empty string for gnome-fallback and to ${DESKTOP_SESSION}- for gnome-shell. Alternately you could symlink applications.menu to gnome-fallback-applications.menu and just use:

    Code:
    export XDG_MENU_PREFIX=${DESKTOP_SESSION}-
    The menus are sorted alphabetically. It's still not optimal, but much easier to read (and also better than the menus shell extension, which does not much). If you want the perfect menu, write your own applications.menu for gnome-fallback and format it afterwards with this xslt to create a flat menu for gnome-shell.


    Screenshots of gnome-fallback and gnome-shell with default menus:



  2. #2

    Default Re: Using classic menus with gnome-shell ...

    please try again wrote:
    > Tree menus are not supported under gnome-shell, but you can reformat
    > your legacy (tree) menu into a flat menu that would include and show all
    > directories (just not in a tree form). Here's a xslt script that might
    > help:


    That's a very helpful message, thanks. I haven't been terribly impressed
    by what I've seen about gnome-shell, but that particular lack of feature
    is a complete showstopper for me. So thanks for saving me from wasting
    any more time!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •