lingnand / VIMonad

Bringing VIM philosophy to window management
vimonad.lynnard.me
70 stars 3 forks source link

GVim (and other programs) does not launch properly #2

Closed torrancew closed 9 years ago

torrancew commented 9 years ago

First off, thank you for releasing this! I have been following your articles on VIM/XMonad integration for some time, and appreciate that you've made it much simpler to replicate.

Having just swapped to VIMonad from XMonad, I noticed that a few programs seem to not launch properly.

Ones that I've noticed:

These programs launch, but no X window is ever rendered that I can find. From what I can tell, the launch wrapper script is not terminating in these cases, for some reason. This observation is based on the fact that I cannot re-open the launcher until I find and kill the PID for the offending program (at which point it appears, containing all keystrokes correpsonding to my attempts to re-open or interact with the launcher). The only customization I have made at this time is changing modKey to mod4Key (Super/Windows).

I thought that perhaps they were just being rendered to a temporary workspace or register, but given that I cannot access any prompts (or interact with the WM at all, really), I cannot confirm this, and it seems less likely. Let me know if I can help reproduce or diagnose this in any way.

EDIT keepassx is also affected by this

EDIT On closer inspection, this probably has more to do with file descriptor state than the termination state of the launch wrapper, as I see the launch wrapper seems to still be present for the perfectly functional windows, as well.

lingnand commented 9 years ago

Sorry for the late reply. In case if you haven't figured it out, the 'launcher' (or DynamicPrompt) works exactly like a terminal - but without a graphical frontend. So if you 'launch' anything that blocks, there won't be a way to terminate it easily like in terminal - where you can Ctrl-C for that. There are a number of ways to get around this

  1. run a command that does something in the background i.e. appending & to the end of the command, for example
  2. after typing the command in the prompt, hit Ctrl-Return to run the command in the background; this is probably better than 1 because it will stop the prompt from returning the output of the command as well
  3. hit Mod-Return to spawn a new xterm that will run the exact command you typed in the prompt

If you don't like any of these approaches you then need to hack into the source code to tell VIMonad that your command will spawn a window (see the list defined by cmdsWithGUI inside DynamicPrompt.hs).

However, the recommended approach to launch commonly used programs is still to use Construct. It gives you more control e.g., the place the window should be inserted, as well as more flexibility e.g. change an existing window. To work properly with this approach be sure to define the right taskGroups inside your xmonad.hs.

torrancew commented 9 years ago

@lynnard the interesting thing in the case of some of the above programs, is that (at least some of them) return. I am wondering if this is a double-fork issue at this point (gvim is a good example, as it returns immediately unless you pass -f).

torrancew commented 9 years ago

Regardless, Ctrl-Return works!

lingnand commented 9 years ago

mhh, it probably is an issue with runProcessWithInput. I've added gvim to cmdsWithGUI so it should work now even without Ctrl-Return