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

Opening a file when another instance is already is running sometimes fails #541

Open
swiftgeek opened this issue Apr 7, 2024 · 6 comments
Labels
linux Related specifically to Linux-based OSs

Comments

@swiftgeek
Copy link

swiftgeek commented Apr 7, 2024

Opening a file when another instance is already is running sometimes fail, ending up with just raising a window and not actually opening the file (ie. MainWindow::bringWindowToForeground() runs in primary instance, but it's not followed by NotepadNextApplication::openFiles(const QStringList&) or anything else )

It might be my imagination, but the more tabs are open the higher the chances of it failing

NotepadNext 0.7 running on linux

New file opened using NotepadNext "/home/user/dir/foo bar.txt"

@dail8859
Copy link
Owner

dail8859 commented Apr 7, 2024

What version of Linux? Is the AppImage or Flatpack?

@dail8859 dail8859 added the linux Related specifically to Linux-based OSs label Apr 7, 2024
@ErickWei
Copy link
Contributor

ErickWei commented Apr 7, 2024

I have also encountered the same problem under MAC. When NN is already open and minimized, double-clicking another file will not wake up NN. The NN window needs to be restored manually, then the file will be imported by NN.

Kapture.2024-04-07.at.12.36.39.webm

@swiftgeek
Copy link
Author

Archlinux, installed from AUR

@ErickWei that sounds like exact opposite to my problem

@ErickWei
Copy link
Contributor

ErickWei commented Apr 7, 2024

Ohh it could be another issue sorry

Archlinux, installed from AUR

@ErickWei that sounds like exact opposite to my problem

@swiftgeek
Copy link
Author

swiftgeek commented Apr 7, 2024

Actually if I minimize like in @ErickWei test case it feels like it's failing a lot less

Normally I'm just switching virtual desktops on KDE

@dail8859
Copy link
Owner

dail8859 commented Apr 7, 2024

Archlinux, installed from AUR

I'm not sure who maintains that repository but I'm assuming this is a general Linux issue and not specifical to Archlinux+AUR.

I have also encountered the same problem under MAC.

There's a few different components to all this working. And it works different depending on OS.

The first part is just forcing the window to be maximized and forcing it to the front of everything else. Most operating systems deem this as being malicious and make it difficult to do this.

The MainWindow::bringWindowToForeground() method probably needs more specific implementations for Linux and Mac. I've had to implement one for Windows just because Qt doesn't provide a good cross-platform way to do it that I've found.

The other piece is sending the information of the file to open to the other instance. It relies on the 3rd party library to implement this and I know there were issues on Qt6.6+. Mac also works slightly differently when telling another instance to open a file. So I'm not completely sure why this would be failing.

I did just recently add some extra debugging info into the application to hopefully help troubleshoot but this will probably be difficult since it seems to be so OS specific.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linux Related specifically to Linux-based OSs
Projects
None yet
Development

No branches or pull requests

3 participants