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 directory" for attached file does not work #8679

Closed
2 tasks done
wujastyk opened this issue Apr 15, 2022 · 30 comments · Fixed by #8831 or #8853
Closed
2 tasks done

"open directory" for attached file does not work #8679

wujastyk opened this issue Apr 15, 2022 · 30 comments · Fixed by #8831 or #8853
Labels
bug Confirmed bugs or reports that are very likely to be bugs os: linux
Projects

Comments

@wujastyk
Copy link

wujastyk commented Apr 15, 2022

JabRef version

Latest development branch build (please note build date below)

Operating system

GNU / Linux

Details on version and operating system

JabRef 5.6--2022-04-15--f13ada0 Linux 5.13.0-39-generic amd64 Java 17.0.2 JavaFX 18+12

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
  2. Go to the "General" tab
  3. Select an attached PDF file
  4. Right click to open context menu
  5. select "open folder" (or ctrl-shift-O)
  6. nothing happens.

More or less the same as #8093, but in a different context.

Appendix

No response

@Siedlerchr
Copy link
Member

Hi just asking some additional information, snap or deb?
Out of curiosity, I recently learned that java.awt.desktop apparently only works with libgnome-2.0. I am not 100% sure here in this case, but do you have that installed or not?

@LyzardKing You worked on this, if I remember correctly, any further ideas?

@wujastyk
Copy link
Author

wujastyk commented Apr 15, 2022

deb
Not sure about libgnome-2.0. Here's what synaptic says:
image77

PS https://wiki.gnome.org/Attic/LibgnomeMustDie

@Siedlerchr
Copy link
Member

Ah, I now remember that we changed this, not sure how this would need to be adapted

public void openFolderAndSelectFile(Path filePath) throws IOException {
String desktopSession = System.getenv("DESKTOP_SESSION");
String cmd = "xdg-open " + filePath.toAbsolutePath().getParent().toString(); // default command
if (desktopSession != null) {
desktopSession = desktopSession.toLowerCase(Locale.ROOT);
if (desktopSession.contains("gnome")) {
cmd = "nautilus" + filePath.toString().replace(" ", "\\ ");
} else if (desktopSession.contains("kde")) {
cmd = "dolphin --select " + filePath.toString().replace(" ", "\\ ");
}
}
Runtime.getRuntime().exec(cmd);

@LyzardKing
Copy link
Collaborator

The last time I looked at it there was no way to port java.awt.desktop to using more modern systems to launch programs/file managers/etc, not easily at least.
I'll give it another go in the next few days and let you know what I come up with

@LyzardKing
Copy link
Collaborator

@wujastyk out of curiosity, what is the output of running env | grep DESKTOP_SESSION in a terminal?

Even in edge cases the default xdg-open command should run fine anyway

@wujastyk
Copy link
Author

I get

$ env | grep DESKTOP_SESSION
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
DESKTOP_SESSION=cinnamon

@LyzardKing
Copy link
Collaborator

If this command works (the path must be absolute) we could replace all the custom parts with this.
It should work on all distros/desktop environments

dbus-send --session --print-reply --dest=org.freedesktop.FileManager1 --type=method_call /org/freedesktop/FileManager1 org.freedesktop.FileManager1.ShowItems array:string:"file://<insert full file path>" string:""

@calixtus
Copy link
Member

Reveal folder works for me, open terminal here not, because i dont have xterm installed, but konsole.

env | grep DESKTOP
DESKTOP_SESSION=plasmawayland
XDG_CURRENT_DESKTOP=KDE
XDG_SESSION_DESKTOP=KDE

@LyzardKing
Copy link
Collaborator

@wujastyk what file manager are you using?
@calixtus there is a condition specific for konsole. What package are you running?

@wujastyk
Copy link
Author

@LyzardKing I'm using Nemo, the file manager of Cinnamon.

@LyzardKing
Copy link
Collaborator

Strange. It should work with the default (running xdg-open <path to folder>)
We can add another option specifically for nemo, but the default command should work anyway. Could you try it in a terminal?

@wujastyk
Copy link
Author

try what in a terminal? Nemo? xdg-open . Both work fine.
image
image

@mlep
Copy link
Contributor

mlep commented Apr 22, 2022

FYI: I am using Nemo and cinnamon too, and I do not have this issue: "open folder" opens nemo with the proper directory.

JabRef 5.6--2022-04-20--f220575
Linux 4.19.0-20-amd64 amd64
Java 17.0.2
JavaFX 18+12

@ThiloteE
Copy link
Member

Using Linux Mint default file explorer

JabRef 5.7--2022-05-16--6a2332f
Linux 5.4.0-110-generic amd64
Java 18.0.1
JavaFX unknown

Having this issue as well.

@ThiloteE ThiloteE added the bug Confirmed bugs or reports that are very likely to be bugs label May 18, 2022
@ThiloteE ThiloteE added this to Normal priority in Bugs via automation May 18, 2022
@ThiloteE
Copy link
Member

ThiloteE commented May 18, 2022

#8679 (comment)

If this command works (the path must be absolute) we could replace all the custom parts with this. It should work on all distros/desktop environments

dbus-send --session --print-reply --dest=org.freedesktop.FileManager1 --type=method_call /org/freedesktop/FileManager1 org.freedesktop.FileManager1.ShowItems array:string:"file://<insert full file path>" string:""

I will mark this issue as a good first issue. Maybe somebody can try what you propose here and open a pull request. If it does not work, we can close the pull request.

@ThiloteE ThiloteE added the good first issue An issue intended for project-newcomers. Varies in difficulty. label May 18, 2022
@LyzardKing
Copy link
Collaborator

actually on further look it's not a good solution.
The dbus service it is using is not available in confined packages like flatpak or snap (as far as I can tell, but I have to look at it more).

@LyzardKing LyzardKing mentioned this issue May 19, 2022
6 tasks
@LyzardKing
Copy link
Collaborator

I opened the PR to add Nemo and Caja in the list of file managers. It still doesn't solve the snap and flatpak.

@ThiloteE
Copy link
Member

ThiloteE commented May 19, 2022

Bugs automation moved this from Normal priority to Done May 19, 2022
@ThiloteE
Copy link
Member

ThiloteE commented May 19, 2022

Unfortunately #8831 did not fix the issue for me. :/ I just tried the newest development version as Linux portable

I am on Linux Mint 20.3 (Cinnamon 64-bit) with Nemo

JabRef 5.7--2022-05-19--4baf2a1
Linux 5.4.0-110-generic amd64
Java 18.0.1
JavaFX unknown

@ThiloteE ThiloteE reopened this May 19, 2022
@ThiloteE ThiloteE removed the good first issue An issue intended for project-newcomers. Varies in difficulty. label May 19, 2022
@ThiloteE
Copy link
Member

Being as curious as I am, I stumpled upon this guide: https://linuxhint.com/installing_nemo_file_manager_linux/

When I checked on my system which mimetypes it is being used for, it showed some other file managers than Nemo attached to the same mimetype, if i understand it correctly. So maybe for this type of action Nemo is not prioritized? I am afraid of completely removing the other ones from this mimetype and making Nemo the defacto default, because it might break other things.

grafik

Not sure if I understand what is going on, but maybe it helps somebody solving this riddle.

@koppor koppor moved this from Done to Normal priority in Bugs May 23, 2022
@ThiloteE ThiloteE mentioned this issue May 25, 2022
2 tasks
@ThiloteE
Copy link
Member

Same problem for

1.  click on entry in entry table.
2.  right click on entry and select open folder. or press ctrl+shift+O.

@ThiloteE
Copy link
Member

Could the d-bus solution be used as fallback? Or alternatively xdg-open as fall-back instead? Or is this an EITHER / OR type of problem?

Related discussion: https://unix.stackexchange.com/questions/364997/open-a-directory-in-the-default-file-manager-and-select-a-file

@ThiloteE
Copy link
Member

ThiloteE commented May 25, 2022

Btw.:

JabRef 5.7--2022-05-23--117bb1c
Linux 5.4.0-113-generic amd64
Java 18.0.1
JavaFX unknown

on Linux Mint 20.3 with Nemo.

thilo@thilo-Aspire-ES1-311 ~ $ env | grep DESKTOP_SESSION
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
DESKTOP_SESSION=cinnamon

and

thilo@thilo-Aspire-ES1-311 ~ $ env | grep DESKTOP
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
DESKTOP_SESSION=cinnamon
XDG_SESSION_DESKTOP=cinnamon
XDG_CURRENT_DESKTOP=X-Cinnamon

@wujastyk
Copy link
Author

JabRef 5.7--2022-05-23--117bb1c
Linux 5.13.0-44-generic amd64
Java 18.0.1
JavaFX unknown

"Open file F4 "now works. "Open folder ctrl+sht+O" does not.

@LyzardKing
Copy link
Collaborator

LyzardKing commented May 26, 2022

@ThiloteE xdg-open is set to be used as a fallback.
Could you try the latest build from https://builds.jabref.org/main/?
In your case the command to run should be nemo --select <filename>

@ThiloteE
Copy link
Member

ThiloteE commented May 26, 2022

Ok, I think I found the problem!

thilo@thilo-Aspire-ES1-311 ~ $ nemo --select test.txt
Could not parse arguments: Unbekannte Option --select

Please remove the --select for nemo
Apparently they removed this option. Nemo is a fork of Nautilus, so yes there are similarities, but at one point they must have removed it.

https://linuxcommandlibrary.com/man/nemo.html

Here up to date commands for nemo:

thilo@thilo-Aspire-ES1-311 ~ $ nemo --help
Aufruf:
  nemo [OPTION …] [Adresse …] 

Browse the file system with the file manager

Hilfeoptionen:
  -h, --help                   Hilfeoptionen anzeigen
  --help-all                   Alle Hilfeoptionen anzeigen
  --help-gtk                   GTK+-Optionen anzeigen

Anwendungsoptionen:
  --version                    Die Programmversion anzeigen
  -g, --geometry=GEOMETRIE     Das Anfangsfenster mit der angegebenen Geometrie erstellen. Beispiele: nemo --geometry=+100+100, nemo --geometry=600x400, nemo --geometry=600x400+100+100+100.
  -n, --no-default-window      Nur für ausdrücklich angegebene Adressen die Fenster erstellen.
  --no-desktop                 Ignorierter Ausdruck – wird nur zur Kompatibilität zugelassen.
  -t, --tabs                   Adressen in Reitern öffnen.
  --existing-window            Adressen in einem bestehenden Fenster öffnen.
  --fix-cache                  Bitte den Benutzervorschaubildpuffer reparieren - das kann nützlich sein, wenn Sie Probleme mit den Vorschaubildern haben. Muss als Systemverwalter ausgeführt werden.
  --debug                      Enable debugging code.  Example usage: 'NEMO_DEBUG=Actions,Window nemo --debug'.  Use NEMO_DEBUG=help for more topics.
  -q, --quit                   Nemo beenden.
  --display=ANZEIGE            X-Anzeige, die verwendet werden soll

I did some tests and using the command nemo Downloads/test.txt via terminal to open my downloads folder and to select the file test.txt worked just fine!

@ThiloteE
Copy link
Member

Maybe it was only working in an older version of Linux Mint:

FYI: I am using Nemo and cinnamon too, and I do not have this issue: "open folder" opens nemo with the proper directory.

JabRef 5.6--2022-04-20--f220575
Linux 4.19.0-20-amd64 amd64
Java 17.0.2
JavaFX 18+12

@ThiloteE
Copy link
Member

@ThiloteE
Copy link
Member

Hello everybody. Christoph and me tried another method that should fix this issue. The new method also works for Linux Mint Cinnamon (Nemo file manager), but we have not tested the other distributions. Would you mind testing the PR 8853? It can be downloaded here: https://builds.jabref.org/pull/8853/merge/

@wujastyk
Copy link
Author

Yes! It worked for me.

JabRef 5.7-PullRequest8853.81--2022-05-26--7636804
Linux 5.13.0-44-generic amd64
Java 18.0.1
JavaFX unknown

Kernel: 5.13.0-44-generic x86_64 bits: 64 compiler: N/A Desktop: Cinnamon 5.2.7
wm: muffin dm: LightDM Distro: Linux Mint 20.3 Una base: Ubuntu 20.04 focal

Thank you all!

Bugs automation moved this from Normal priority to Done Jun 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bugs or reports that are very likely to be bugs os: linux
Projects
Archived in project
Bugs
  
Done
6 participants