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

Auto disown when opening in gui #108

Closed
aflyingpumpkin opened this issue Apr 26, 2021 · 57 comments
Closed

Auto disown when opening in gui #108

aflyingpumpkin opened this issue Apr 26, 2021 · 57 comments

Comments

@aflyingpumpkin
Copy link
Contributor

aflyingpumpkin commented Apr 26, 2021

Upon opening an application in gui the current terminal window is still linked to the gui. Meaning that I cannot close it without it closing the GUI. I am also locked out of the current xplr session. Meaning I cannot browse other files after opening a single file. Upon closing the GUI application the GUI for xplr becomes messed up. (view attached image.)
image

@sayanarijit
Copy link
Owner

You can use ctrl-r to reset the screen. Or terminal resize should also work.

@sayanarijit
Copy link
Owner

@aflyingpumpkin let me know if ^ this works.

@aflyingpumpkin
Copy link
Contributor Author

aflyingpumpkin commented Apr 26, 2021

@aflyingpumpkin let me know if ^ this works.
This does resolve the buggy visuals open closing a gui. Though I still can't use xplr while a GUI application is open.

@sayanarijit
Copy link
Owner

Should solve. I can't can test it now because my window manager will autoresize the screen which causes the refresh automatically.

@sayanarijit
Copy link
Owner

CTRL+R doesn't solve it? Can you pls provide more info like which OS, window manager, terminal are you using?
A gif would be awesome.

@aflyingpumpkin
Copy link
Contributor Author

My window manager (dwm) also resizes the window upon closing the GUI. But I believe the GUI the process is not completely terminated when the window resizes which causes the buggy visuals. Also, I am locked out of xplr when the gui is open.

@sayanarijit
Copy link
Owner

Have you tried other terminals?

@aflyingpumpkin
Copy link
Contributor Author

Just tried in Alacritty and the issue still persists.

@sayanarijit
Copy link
Owner

Which application are you trying to open?

@sayanarijit
Copy link
Owner

If I run xdg-open x.doc, it opens in Kate and works fine.

@sayanarijit
Copy link
Owner

sayanarijit commented Apr 26, 2021

Just FYI this command is being executed.

@sayanarijit
Copy link
Owner

${OPENER:-open} "${XPLR_FOCUS_PATH:?}" &> /dev/null &

This might solve the issue but need to test it. @aflyingpumpkin can you try overwriting the command?

@aflyingpumpkin
Copy link
Contributor Author

${OPENER:-open} "${XPLR_FOCUS_PATH:?}" &> /dev/null & disown -h
Fixes my issue though it does cause some text to be displayed on xplr when opening prior to window resize

@aflyingpumpkin
Copy link
Contributor Author

image
is the text that appears

@sayanarijit
Copy link
Owner

And ctrl+r doesn't fix it?

@aflyingpumpkin
Copy link
Contributor Author

ctrl+r fixes it, and it usually goes away when the application is opened unless I am in fullscreen mode.

@sayanarijit
Copy link
Owner

Hmm... not sure how to workaround this without a proper testing environment. @aflyingpumpkin if possible, can you pls create a PR?

@aflyingpumpkin
Copy link
Contributor Author

What is a PR?

@sayanarijit
Copy link
Owner

A pull request with the fix. No problem, I can do this.

@aflyingpumpkin
Copy link
Contributor Author

Just found out that the random text was due to me accidentally putting:
OPENER="$(which xdg-open $)"
instead of
OPENER="$(which xdg-open)"

@sayanarijit
Copy link
Owner

Ah ok.. Unfortunately the disown hack is causing other side effects. After I exit the session, the terminal session is messed up if there are disowned jobs. I think we need to investigate more into this.

@sayanarijit
Copy link
Owner

Nope, that was my fault. I used disown incorrectly and didn't exit the terminal.

sayanarijit added a commit that referenced this issue Apr 26, 2021
sayanarijit added a commit that referenced this issue Apr 26, 2021
@aflyingpumpkin
Copy link
Contributor Author

I found an issue with the disown hack. If xplr is still open and the terminal is terminated the gui will also be terminated.

@sayanarijit
Copy link
Owner

Weird... Not in my WM...

@sayanarijit
Copy link
Owner

sayanarijit commented Apr 26, 2021

I'll setup a test VM with dwm when I get some time. Meanwhile, @aflyingpumpkin you can experiment with different command combinations and let me know if you find anything that works.

@sayanarijit
Copy link
Owner

Although if it's too hacky, we'll probably need to report the issue to DWM maintainers.

@maximbaz
Copy link
Contributor

I got a ping on the (now closed) PR, to be honest I can't reproduce the issue on latest main (kitty, sway, arch) - i can open multiple files using gx, I can then close xplr, close terminal, and all gui app will remain and will function properly 🤷‍♂️

@maximbaz
Copy link
Contributor

What's your $OPENER? I recently discovered that xdg-open is quite weird sometimes, after I forced it to be an alias to gio open my life became so much better and random bugs just went away. Could it be this case too? 🤔

My solution was to simply create an executable script called ~/.local/bin/xdg-open with the contents below (assuming ~/.local/bin is first in $PATH):

#!/bin/sh

gio open "$@"

Maybe worth a try for you too? Do this, open new terminal, double check that which xdg-open now points to it, and then retry.

@aflyingpumpkin
Copy link
Contributor Author

I am using xdg-open, after doing a force alias the bug still persists.

@aflyingpumpkin
Copy link
Contributor Author

I think it may be a problem with disown. Currently only having the & symbol is needed, and disown -h should block the termination signal from doing anything.

@sayanarijit
Copy link
Owner

@aflyingpumpkin I was using plain disown, not disown -h.

@sayanarijit
Copy link
Owner

@aflyingpumpkin
Copy link
Contributor Author

I saw, even when I use what was put in the pull request the issue still exists.

@sayanarijit
Copy link
Owner

sayanarijit commented Apr 26, 2021

Maybe it's WM specific bug? Need to test it on different window managers. So far as we know,

KDE + KWin -> Working
SWAY (I3) -> Working
DWM -> Broken
GNOME -> Not tested
XFCE -> Not tested
I3 (stock) -> Broken
I3-status -> Not tested
BSPWM -> Not tested
AwesomeWM -> Not tested
qtile -> Not tested
xmonad -> Not tested

@aflyingpumpkin
Copy link
Contributor Author

I have tried stock i3 and it appears to be broken.

@sayanarijit
Copy link
Owner

sayanarijit commented Apr 26, 2021

I wish I had more users in our discord channel, then I could just ping users to test report this 😄

@aflyingpumpkin
Copy link
Contributor Author

Just tried kwin with alacritty and kitty and I am still running into the issue. I also tried switching to zsh and I am still running into the issue.

@sayanarijit
Copy link
Owner

Wow, then it seems more like a platform issue? Which OS are you using?

@aflyingpumpkin
Copy link
Contributor Author

I use arch btw

@sayanarijit
Copy link
Owner

And maybe shell?

@aflyingpumpkin
Copy link
Contributor Author

I tried on both zsh and bash.

@sayanarijit
Copy link
Owner

Very strange. I'm out of ideas. Can you record a video? I think GitHub allows posting video files.

@sayanarijit
Copy link
Owner

image

GitHub broke 😄

@aflyingpumpkin
Copy link
Contributor Author

No, I deleted the message because the aspect ratio was messed up.
https://user-images.githubusercontent.com/49350251/116135449-28d52400-a69f-11eb-9664-f58095b81292.mp4

@sayanarijit
Copy link
Owner

@aflyingpumpkin you can maybe also capture a GIF using https://github.com/phw/peek. Preferably the KDE-Kwin one.

@sayanarijit
Copy link
Owner

No, I deleted the message because the aspect ratio was messed up.
https://user-images.githubusercontent.com/49350251/116135449-28d52400-a69f-11eb-9664-f58095b81292.mp4

Runs on VLC

@sayanarijit
Copy link
Owner

It the video xplr seems to work fine? You opened the file, then closed xplr?

@aflyingpumpkin
Copy link
Contributor Author

The first example where they both closed at the same time was when I left xplr open and closed the terminal. The second example when the document stayed open was due to the fact that I fist closed xplr then closed the terminal.

@sayanarijit
Copy link
Owner

sayanarijit commented Apr 26, 2021

Ah okay, so that's what you meant.

@sayanarijit
Copy link
Owner

sayanarijit commented Apr 26, 2021

Yes I can reproduce this. I don't think you're supposed to close the terminal before quitting xplr gracefully.

@sayanarijit
Copy link
Owner

The document will stay open. You close it separately. It's the expected behavior I guess.

@sayanarijit
Copy link
Owner

Or, if you want to open multiple documents, you can do so, but you need to close them manually and quit xplr gracefully.

@sayanarijit
Copy link
Owner

You can probably achieve what you want to, using nohup or screen or tmux. But I don't think it should be the default in xplr.

@aflyingpumpkin
Copy link
Contributor Author

Alright, thanks

@sayanarijit
Copy link
Owner

@aflyingpumpkin v0.9.1 probably fixed the issue in a way you wanted. You can close the terminal after opening apps in GUI, without closing them.

@aflyingpumpkin
Copy link
Contributor Author

Great!

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

Successfully merging a pull request may close this issue.

3 participants