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

Open fails when xdg-open would launch a terminal program #10045

Closed
genevieve-me opened this issue Oct 4, 2023 · 2 comments
Closed

Open fails when xdg-open would launch a terminal program #10045

genevieve-me opened this issue Oct 4, 2023 · 2 comments
Labels
bug Something that's not working as intended
Milestone

Comments

@genevieve-me
Copy link

  • fish 3.6.1
  • Linux 6.6.0-rc3 Need a history built-in #1-NixOS SMP PREEMPT_DYNAMIC
  • I tried running fish with no configuration (sh -c 'env HOME=$(mktemp -d) XDG_CONFIG_HOME= fish') and experienced the same behavior

Expected behavior

> echo $EDITOR
hx
> xdg-mime query default inode/directory 
lf.desktop
> xdg-open ~/mydirectory
(lf opens)
> open ~/mydirectory
(lf opens)
> open ~/myfile.txt
(hx opens)
> xdg-open ~/myfile.txt
(hx opens)

Current behavior

> xdg-open ~/mydirectory
(lf opens)
> open ~/mydirectory
(nothing happens and I'm still at a fish prompt)
> open ~/myfile.txt
(nothing happens and I'm still at a fish prompt)
> xdg-open ~/myfile.txt
(hx opens)

Furthermore, I tried copying the basic behavior of open.fish, and the following occurs:

> function opentest
       for i in $argv
             xdg-open $i
         end
     end
> opentest somedir/
(lf is opened correctly)

I see mention of a possible issue in the code comment here : https://github.com/fish-shell/fish-shell/blob/4ab34f2e86f91e90e732302446f1382cc122f07c/share/functions/open.fish#L33C48-L33C48 : could that be relevant?

@faho
Copy link
Member

faho commented Oct 4, 2023

The issue here is that we background the xdg-open - we use xdg-open $i &. This is a workaround for an issue where in some paths it'll do that itself and in others won't.

Fundamentally we can't detect that and have to pick one - either we work around that bug or we enable things running in the terminal.

Ideally that would be fixed in xdg-open, but it's been pretty unmaintained for years (and never was all that great tbqh). If it isn't I'm not sure if we want to reintroduce a bug for graphical applications, which xdg-open was always geared towards more, or if we want to allow terminal applications.

Or we could always drop the open function and let people deal with it themselves.

@faho
Copy link
Member

faho commented Oct 4, 2023

This is a workaround for an issue where in some paths it'll do that itself and in others won't.

Fixed in xdg-utils 1 month ago.

@faho faho closed this as completed in f8e3881 Oct 4, 2023
@faho faho added this to the fish 3.7.0 milestone Oct 4, 2023
@faho faho added the bug Something that's not working as intended label Oct 4, 2023
faho added a commit that referenced this issue Oct 8, 2023
This was introduced as a workaround to #7215 - xdg-open's generic path
wouldn't background graphical apps.

This has been fixed a month ago in xdg-open, so we can stop doing it.

The good news is this also allows terminal apps to be used again, so
it

Fixes #10045

(cherry picked from commit f8e3881)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that's not working as intended
Projects
None yet
Development

No branches or pull requests

2 participants