-
Notifications
You must be signed in to change notification settings - Fork 135
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
Global State for Char Mode/Line Mode #352
Comments
This is not implemented yet. Switching between these two modes not only requires setting up some buffer-local variables but selecting/unselecting some events on the managed X window. Do you have any specific use case for this? |
I am using exwm with Spacemacs. This requires a bit of fiddling, but works reasonably well. Basically, I only use char mode for interaction, and set line mode passthrough to true always. This maps pretty well to Spacemacs' notion of insert/normal state. One problem exists with minibuffer input. There are a couple of functions that need to be adviced to make sure that char mode is deactivated to allow input be sent to emacs. While this is possible, switching back to line mode reliably is not so easy, since the minibuffer-input-requiring function can change the buffer layout, and I would need to store the information of which buffer was in what mode before minibuffer input to be able to restore the correct char/line mode after the input operation finishes. One simpler alternative would be to just store a char/line mode globally for all exwm buffers, which also would reduce the mental effort to check for the buffer's state after each switch. Returning to the correct state, regardless of which buffers are visible and active, is thus also much easier. Hope that makes sense... |
As I've mentioned earlier, switching between line-mode and char-mode for all X windows is quite expensive. An alternative is to put all X windows in line-mode and use
Isn't this a no-op if you always stay in line-mode? |
Is there an observable difference between char-mode and line-mode without any defined bindings? If not, I think that may solve the problem. It would affect the intended operation modes, though. I originally had in mind:
I did not use the 3rd mode yet, so it may not make a difference, but If I wanted to have something like this, I suppose I would switch in/out the exwm mode keymap, correct? |
Line mode without any defined binding is almost equivalent to char-mode. And if you want you can disable most default bindings. So there's no need to use char mode in your case. Just stay in line-mode and use |
@timor With |
For reference, one case I came across where it seems to be not equivalent is at least one SDL-based application. In that case, in line-mode the keys are sent twice. |
Which application? That sounds like a new bug to me. |
This one: https://cataclysmdda.org |
I tried cataclysm and while I totally know nothing about the game, the problem you descried do exist. However not every key press are 'sent' twice; I should say it's about 50-50 here. I suspect it's because how the application treats KeyPress and KeyRelease events as EXWM delays KeyPress events a bit, but it requires debugging that application. It's not a good idea to play games in line-mode after all, so perhaps you should always put them in char-mode via per-application configurations? |
Yes, I suppose so. Should be acceptable as a solution. Char mode is usually only one keybinding away anyways... |
Is it possible to have a global notion of char mode/line mode vs. the per-window state that is used now?
The text was updated successfully, but these errors were encountered: