Menu

#588 lxpanel doesn't interpret %c in .desktop files correctly

closed-fixed
nobody
lxpanel (297)
5
2014-01-27
2013-07-17
Anonymous
No

so, KDE (11rc1) removed the double-quotes around %c in .desktop files and now lxpanel won't run my games

e.g., this used to work: Exec=bomber -caption "%c"

but now that's: Exec=bomber -caption %c
which doesn't work (the application fails as if %c gets replaced by nothing )

http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s06.html
"Field codes must not be used inside a quoted argument, the result of field code expansion inside a quoted argument is undefined."

So it seems the kde devs are correct there.

The standard (same page) also says that "Implementations must take care not to expand field codes into multiple arguments unless explicitly instructed by this specification.This means that name fields, filenames and other replacements that can contain spaces must be passed as a single argument to the executable program after expansion." So the double-quotes serve no useful purpose that i can see, anyway.

Discussion

  • tarakbumba

    tarakbumba - 2013-12-23

    This issue also effects Mageia GNU/Linux distribution badly. Any user who installed any KDE application can not run from menu or panel. This issue should be fixed and critical. See related Mageia bug report:

    https://bugs.mageia.org/show_bug.cgi?id=11951

     
  • maxkrummi

    maxkrummi - 2014-01-18

    From d9bd9b6f57ce53a982e5f83550cb9ebc3d4406f9 Mon Sep 17 00:00:00 2001
    From: Max Krummenacher <max.oss.09@gmail.com>
    Date: Sat, 18 Jan 2014 10:52:21 +0100
    Subject: [PATCH] menu: fix ID: 3614733, doesn't interpret %c in .desktop

    lxpanel doesn't interpret %c in .desktop files correctly - ID: 3614733
    As a result items using %c won't start, e.g. a lot of KDE applications fail
    as %c is replaced by nothing.
    Exec=kmines -caption %c

    Handle also %i correctly.

    While at it fix inconsistent whitespace (tab to spaces).
    ---
    src/plugins/menu.c | 11 +++++++++--
    1 file changed, 9 insertions(+), 2 deletions(-)

    diff --git a/src/plugins/menu.c b/src/plugins/menu.c
    index 9998ab2..31d05f2 100644
    --- a/src/plugins/menu.c
    +++ b/src/plugins/menu.c
    @@ -193,9 +193,16 @@ menu_pos(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, GtkWidget *widget)

    static void on_menu_item( GtkMenuItem* mi, MenuCacheItem* item )
    {
    - lxpanel_launch_app( menu_cache_app_get_exec(MENU_CACHE_APP(item)),
    + char * exec;
    + /* handle %c, %i field codes */
    + exec = translate_exec_to_cmd( menu_cache_app_get_exec(MENU_CACHE_APP(item)),
    + menu_cache_item_get_icon(item),
    + menu_cache_item_get_name(item),
    + NULL );
    + lxpanel_launch_app( exec,
    NULL, menu_cache_app_get_use_terminal(MENU_CACHE_APP(item)),
    - menu_cache_app_get_working_dir(MENU_CACHE_APP(item)));
    + menu_cache_app_get_working_dir(MENU_CACHE_APP(item)));
    + g_free(exec);
    }

    /* load icon when mapping the menu item to speed up */
    --
    1.8.4

     
  • Henry Gebhardt

    Henry Gebhardt - 2014-01-27

    Thanks, applied! In the future, please attach patches so that the lines don't get garbled.

     
  • Henry Gebhardt

    Henry Gebhardt - 2014-01-27
    • status: open --> closed-fixed
     

Log in to post a comment.