kspi / dmenu-frecency

A dmenu-based desktop application launcher
MIT License
33 stars 8 forks source link

Exec key is not parsed #4

Closed willemw12 closed 9 years ago

willemw12 commented 9 years ago

Some of the Exec key values from .desktop files are passed (incorrectly) to the launched program.

For example,

gwenview.desktop:Exec=gwenview %U -caption %c %i

Results in error message:

Loading ‘%i’ failed
Could not open file /home/willem/%i

And the window title is "%c".

Desktop Exec key specification: http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables

BTW, I have created a package for Arch Linux (https://aur.archlinux.org/packages/dmenu-frecency-git/).

kspi commented 9 years ago

Thank you for the report. I'll implement proper Exec parsing when I have some free time.

I use Arch Linux myself, so I guess I'll install the package too. :-)

willemw12 commented 9 years ago

OK. Had a look at i3-dmenu-desktop to see how special field codes (%) are handled there. Now I have come up with a small fix for this dmenu-frecency issue.

If you like I can create a pull request, so you can have a look (later on).

kspi commented 9 years ago

Of course, do create a pull request then.

kspi commented 9 years ago

I've merged the fix, but it still uses regexes, so I will implement real parsing for the field eventually.

willemw12 commented 9 years ago

With the current fix more, maybe all, kde programs are launched properly.

I think only handling "Quoting" and "Reserved characters" is missing. Some of these reserved characters I don't see being handled in i3-dmenu-desktop.

kspi commented 9 years ago

I implemented parsing of the Exec key without regexes in a899210f7c8e39b2bd59c9c045a170af4cdbb5e7 using shlex. Hopefully it works well. The state format changed slightly so visits are cleared when updating.

willemw12 commented 9 years ago

Some issues I found. When launching 'KDE Dolphin':

Exec=dolphin %i -caption %c %u

the window title is system-file-manager - Dolphin, expected <my user name> - Dolphin.

Launching 'KDE System Settings'

Exec=systemsettings -caption %c %i

fails:

$ dmenu-frecency                    
systemsettings: Unexpected argument 'preferences-system'.
systemsettings: Use --help to get a list of available command line options.
kspi commented 9 years ago

Ah, I misread the specification for %i, it should be fixed now.

willemw12 commented 9 years ago

Still getting the same issues with commit 952e8fa.

kspi commented 9 years ago

Does the issue persist after launching 'dmenu-frecency --read-apps'? The relevant code is only executed when updating the cache. Dolphin and Gwenview launch properly for me.

willemw12 commented 9 years ago

That solved it (removed the cache before running 'dmenu-frecency --read-apps').