Eugene Marcotte
Eugene Marcotte

Reputation: 768

URL Handler for gnome applications in cygwin?

I've set up a windows machine with Cygwin/X and have a terminal running in that environment. The "click on things that look like links" feature works well, but GNOME fires a popup saying it does not know how to open the http url scheme.

I've found many references to xdg mime types, .desktop files/application files, and got as far as having:

$ xdg-mime query default x-scheme-handler/http
emarcotte-http.desktop

$ cat /usr/share/applications/emarcotte-http.desktop
[Desktop Entry]
Type=Application
Name=Browser Handler!
Exec=~emarcotte/browser.sh %u
StartupNotify=false
MimeType=x-scheme-handler/http;x-scheme-handler/https;

$ cat ~/browser.sh 
EXE="/cygdrive/c/Program Files/Mozilla Firefox/firefox.exe"
"$EXE" "$*"

But I still get the popup saying that there's no registered handler.

Has anyone figured out a secret trick to enable the GNOME url handlers in cygwin?

Upvotes: 0

Views: 291

Answers (2)

Eugene Marcotte
Eugene Marcotte

Reputation: 768

Turns out you can't use ~ in the Exec. Setting the full path the browser opens right up.

Upvotes: 0

PvR
PvR

Reputation: 71

Did some digging this morning. I don't have my Windows machine in front of me right now, but can do some testing this afternoon.

In case they're helpful, below are the resources I found that I plan to leverage for testing.


Is xdg-utils installed (with all dependencies)? That's the Cygwin toolset containing xdg-open.


Per the xdg-utils repo README, you could try playing with PATH; something along the lines of:

export PATH=$PATH:$INSTALL_DIR/xdg-utils
xdg-desktop-menu install $INSTALL_DIR/mycompany-myapp.desktop

How are your DESKTOP and DISPLAY environment vars set? Does the browser properly open if you call xdg-open directly?

xdg-open https://[URI].html

You may have some luck adjusting them (suggestion found in this top-voted answer) regarding a similar issue repurposing this solution for a default PDF handler issue in Gnome terminal virtualized on Ubuntu:

export DISPLAY=:0
export GNOME_DESKTOP_SESSION_ID=0
xdg-open document.pdf

Your error description makes me think that the issue lies more with the actual handler service than a pointer, but I have no idea how specific the error handling is, so while this thread is Fedora-specific, it does describe a similar issue stemming from mimeapps records stored in the below directory in a virtualized configuration. Since initial resolution in 2011, it sees to have re-appeared in 2019:

~/.local/share/applications/mimeapps.list

If none of those help, I also found a slew of tools for configuring file/URI default apps on the arch wiki. You could probably repurpose one of these to use as your handler.


I hope one of those leads you down the right PATH 😒. I'll do some testing later if none of them get you anywhere.

Upvotes: 1

Related Questions