Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Path= key support #52

Closed
akinokonomi opened this issue May 1, 2023 · 4 comments
Closed

[Feature Request] Path= key support #52

akinokonomi opened this issue May 1, 2023 · 4 comments

Comments

@akinokonomi
Copy link

akinokonomi commented May 1, 2023

Path key seems to be completely ignored.
Is there any way to make it work via config or something?

Tested with latest version 0.91.

Test desktop entry content:

[Desktop Entry]
Type=Application
Name=test
Exec=sh -c "notify-send path \\"\\$(pwd)\\""
Path=/usr/bin
Categories=Utility;

Basically, this should happen:

cd /usr/bin
notify-send path "$(pwd)"

Thanks!

EDIT: valid desktop entry command

@akinokonomi
Copy link
Author

7f29fd7

Getting error "Invalid output from pipemenu", if Path= contains CJK characters.

Checked with xmllint:

% obmenu-generator -i | xmllint -
-:177: parser error : Input is not proper UTF-8, indicate encoding !

Also, for some reason, test entry does not work correctly, I get following notification:

title: path
message: (pwd)

While it should be:

title: path
message: /usr/bin

Here's the generated item:

<item label="test" icon="/path/to/icon.png"><action name="Execute"><command><![CDATA[perl -e "chdir(qq[\/usr\/bin]); exec(qq[sh\ \-c\ \"notify\-send\ path\ \\\\\"\\\\\$\(pwd\)\\\\\"\"])"]]></command></action></item>

Same entry but without Path= key works as expected.

Here's generated item:

 <item label="test2" icon="/path/to/icon.png"><action name="Execute"><command><![CDATA[sh -c "notify-send path \"\$(pwd)\""]]></command></action></item>

@trizen
Copy link
Owner

trizen commented Aug 30, 2023

Thanks for testing! Can you, please, test the above commit as well to see if it fixes the issues? Thanks!

@akinokonomi
Copy link
Author

No problem!

Checked latest commit, working great. Did not see any issues, so far.

One thing, though.
I think application should not execute, if Path= directory does not exist or can't be accessed.
(Like using shell's cd dir && cmd, instead of cd dir; cmd.)

Though specification does not say anything about it
https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#recognized-keys

If entry is of type Application, the working directory to run the program in.

For reference, Rofi does not execute application and errors out, if Path= dir does not exist.

Of course, because obmenu can't show a graphical error, user would not be able to understand right away why application does not start, but I think it's better that way than having problems when application is executed in a wrong working directory.

Thank you

trizen added a commit that referenced this issue Aug 31, 2023
Execute the command only when we can change directory to the specified path.

Now it also supports commands that include single quotes, like:

	Exec=tilix --new-process -e perl -E \'system\("pwd"\)\; system\("zsh"\)\'
@akinokonomi
Copy link
Author

20e320f
Now it also supports commands that include single quotes, like:

I thought single quotes were not supported in Exec= key.
Regardless, that commit did not break anything for me, and my previous point was addressed, so I'm gonna close it.

Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants