chmln / handlr

A better xdg-utils
MIT License
608 stars 24 forks source link

can this be used both for GUI and terminal apps? #30

Closed Dieterbe closed 3 years ago

Dieterbe commented 3 years ago

is this even a good idea? I notice that you can only set .desktop file handlers, not arbitrary commands. desktop files seem to be oblivious to whether handlr will be invoked from a terminal or not, so does it make sense to mix these use cases?

0jdxt commented 3 years ago

handlr can be used as a replacement for xdg-open so, yes. I create .desktop files for programs without them, even for personal scripts. Some mimetypes i choose between GUI or CLI. I hope this answers your question.

Dieterbe commented 3 years ago

Hi @0jdxt thanks for your reply. how do you write the desktop files such that they work whether you're in a terminal already, or when you're in a graphical UI and need to create a fresh terminal?

0jdxt commented 3 years ago

Could you give an example? So I can understand better what you mean

0jdxt commented 3 years ago

I think I got it, I recently set mine up so amfora opens Gemini links, just set Terminal=true in the desktop file

freed00m commented 3 years ago

This is still eluding me. I've tried something like

[Desktop Entry]
Type=Application
Name=Neovim editor
Exec=/usr/bin/nvim %F
Terminal=true
Icon=gvim
Categories=Utility;TextEditor

Then nothing happens, it blinks possibly with error I can't read. While command outside handlr open works fine and other binaries like "notify-send" also works and shows me the filename.

Nano also prints "Too many errors from stdin"

I am beginning to think the setup is fragile.

EDIT: it's a bug, xdg-utils will launch the app as expected, handlr will send app into background after spawn.. I will attempt to file an issue #34

chmln commented 3 years ago

handlr now properly supports Terminal=true apps along with GUI ones. Feel free to re-open or create new issues if you run into problems