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 folder" opens file instead of folder #9607

Closed
2 tasks done
evanhorn opened this issue Feb 8, 2023 · 14 comments · Fixed by #9966
Closed
2 tasks done

"open folder" opens file instead of folder #9607

evanhorn opened this issue Feb 8, 2023 · 14 comments · Fixed by #9966

Comments

@evanhorn
Copy link

evanhorn commented Feb 8, 2023

JabRef version

5.9 (latest release)

Operating system

GNU / Linux

Details on version and operating system

Ubuntu 20.04 with GNOME Shell 3.36.9

Checked with the latest development build

  • I made a backup of my libraries before testing the latest development version.
  • I have tested the latest development version and the problem persists

Steps to reproduce the behaviour

  1. Select an entry associated with a file
  2. Right click on entry and select Open folder from context menu (or ctrl-shift-O)

Instead of a file browser, the attached file is opened as though Open file was selected.

Note that this behavior also occurs when using the "File" field in the "General" tab.

Appendix

Originally observed with:

JabRef 5.9--2023-01-08--76253f1a7
Linux 5.15.0-58-generic amd64
Java 19.0.1
JavaFX 19+11

Confirmed with development branch:

JabRef 5.10--2023-02-07--ae84b22
Linux 5.15.0-58-generic amd64
Java 19.0.2
JavaFX 19+11

@ThiloteE
Copy link
Member

ThiloteE commented Feb 8, 2023

Cannot reproduce on

  1. Windows 10.

  2. JabRef 5.9--2023-01-08--76253f1a7
    Linux Mint 5.4.0-137-generic amd64
    Java 19.0.1
    JavaFX 19+11

    Linux Mint is based on Ubuntu, but the Userinterface is made to look like old Gnome 2. Linux Mint 5.4 is based on Ubuntu 2.04 i believe, but uses Nemo as its file manager

    I suspect what you experience may be caused by either you having misclicked on "Open file", which is right beneath or it is something peculiar to Ubuntu's file manager "Nautilus". Last year, there was a rework, which fixed "Open Folder". This fix was tested on a then very up to date Fedora system running Nautilus. Since - to my knowledge - Ubuntu 20.04 also uses Nautilus as its filemanager, but is a little older, it could be that only newer versions of Nautilus may be compatible with this "new" fix.

I would like to ask you to test JabRef with Ubuntu 22.04 or even better 22.10 and report back.

@waterflow80
Copy link
Contributor

waterflow80 commented Feb 8, 2023

@evanhorn @ThiloteE I tried it on my Ubuntu machine and the same happened for me. The open folder option opens the file
attached with the entry, and not a file browser.
If there are multiple files attached, it opens the first file that has been attached to the entry.

I will try to find out why did this happen and I'll try to fix it.

I'm using Ubuntu 20.04.

@evanhorn
Copy link
Author

evanhorn commented Feb 9, 2023

This isn't a big deal, just a minor annoyance, as I don't often need to access the file's folder. However, I didn't see that anyone else had identified this issue (I did see the conversation from last year), so I wanted to pass it along.

I am glad to see that someone else is experiencing the issue, so it's not just me! It does seem to be related to Ubuntu 20.04 in some way, which surprises me, as ctrl-o opens the “Open library” dialog in Nautilus, so something is able to open Nautilus—it just seems weird to me that it opens the file instead.

If there is any more information that I can provide, please let me know.

@ilippert
Copy link
Contributor

ilippert commented Feb 12, 2023

Am on Fedora37

with

JabRef 5.10-PullRequest9604.122--2023-02-07--1452eb6
Linux 6.1.9-200.fc37.x86_64 amd64
Java 19.0.2
JavaFX 19+11

cannot confirm. That is: open folder works fine, activating Nautilus and selecting the file in the folder.

@ThiloteE
Copy link
Member

Note to myself: Linux Mint 21.10 uses Nemo as its file manager.

@AEgit
Copy link

AEgit commented Feb 23, 2023

I can reproduce this behaviour on Ubuntu 22.04:

JabRef 5.10--2023-02-21--563f52f
Linux 5.15.0-60-generic amd64
Java 19.0.2
JavaFX 19+11

@DanielBiskup
Copy link

Same here on Ubuntu 23.04

JabRef 5.9--2023-01-08--76253f1a7
Linux 6.2.0-20-generic amd64
Java 19.0.1
JavaFX 19+11

@Siedlerchr
Copy link
Member

@DanielBiskup Can you try the latest version?
https://builds.jabref.org/main/

@evanhorn
Copy link
Author

evanhorn commented May 9, 2023

I tried the latest version and still experience the same issue, but I have upgraded to Ubuntu 22.04.

JabRef 5.10--2023-05-08--68b72e0
Linux 6.2.0-76060200-generic amd64
Java 20.0.1
JavaFX 20+19

@kbauer
Copy link

kbauer commented May 30, 2023

  1. System information
  2. Workaround
  3. Observations

1. System information

Just ran into the same issue with

JabRef 5.10--2023-05-20--8d1bb00
Linux 5.3.18-150300.59.106-default amd64
Java 20.0.1 
JavaFX 20+19

The System is an Open Suse 15.3 desktop, using the XFCE desktop environment.

2. Workaround

I was able to solve it for my system by configuring File > Preferences > External Programs > Use custom file browser to the value

/usr/bin/dolphin %DIR

image

3. Observations

Additionally I observed, that when opening a PDF file or opening a folder with the custom file browser, a corresponding event will be logged when executing with

JabRef --debug --console

but when "Use custom file browser" is disabled, nothing will be logged, and the PDF file will open.

Possibly related: On my system, the "open terminal here" wasn't working.

image

That part I solved by setting "use custom terminal emulator" to xfce4-terminal --working-directory=%DIR. But it might hint at an underlying problem detecting the correct programs. Sadly, when using the default program, the command is not logged, making it harder to recognize the root of the issue.

@Siedlerchr
Copy link
Member

The terminal issue will hopefully be fixed by #9954

@Siedlerchr
Copy link
Member

Siedlerchr commented May 30, 2023

@kbauer What does the environment variable DESKTOP_SESSION print?
JabRef checks for some standard file managers and falls back to xdg open

public void openFolderAndSelectFile(Path filePath) throws IOException {
String desktopSession = System.getenv("DESKTOP_SESSION");
String absoluteFilePath = filePath.toAbsolutePath().toString();
String[] cmd = {"xdg-open", absoluteFilePath}; // default command
if (desktopSession != null) {
desktopSession = desktopSession.toLowerCase(Locale.ROOT);
if (desktopSession.contains("gnome")) {
cmd = new String[] {"nautilus", "--select", absoluteFilePath};
} else if (desktopSession.contains("kde") || desktopSession.contains("plasma")) {
cmd = new String[] {"dolphin", "--select", absoluteFilePath};
} else if (desktopSession.contains("mate")) {
cmd = new String[] {"caja", "--select", absoluteFilePath};
} else if (desktopSession.contains("cinnamon")) {
cmd = new String[] {"nemo", absoluteFilePath}; // Although nemo is based on nautilus it does not support --select, it directly highlights the file
}

I think the problem is that we give the path to the file and not the folder when we use xdg open as fallback!
The fallback should probably look like:

String[] cmd = {"xdg-open", filePath.getParent().toString()}; // default command

Regarding the terminal error message:
JabRef tries to read/parse /etc/alternatives/x-terminal-emulator

@kbauer
Copy link

kbauer commented May 31, 2023

@Siedlerchr

>>> echo $DESKTOP_SESSION 
/usr/share/xsessions/xfce

My system has no file /etc/alternatives/x-terminal-emulator.

Maybe xdg-terminal would help?

Siedlerchr added a commit that referenced this issue May 31, 2023
@Siedlerchr
Copy link
Member

@DanielBiskup can you please if this version opens the folder correctly? https://builds.jabref.org/pull/9966/merge/
and if it selects the file (if that is possible with thunar)?

Siedlerchr added a commit that referenced this issue Jun 4, 2023
* Fix opening folder instead of file under linux

fixes #9607
add thunar + xfce check

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

Successfully merging a pull request may close this issue.

8 participants