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

Embedded terminal in IntelliJ IDEA (xkeysnail, ubuntu 20.04) #181

Closed
Mahoney opened this issue May 18, 2020 · 4 comments
Closed

Embedded terminal in IntelliJ IDEA (xkeysnail, ubuntu 20.04) #181

Mahoney opened this issue May 18, 2020 · 4 comments
Assignees
Labels
question Further information is requested

Comments

@Mahoney
Copy link
Contributor

Mahoney commented May 18, 2020

Hi,

I'm hoping I can contribute some stuff back, but at the moment I'm very raw on understanding this stuff...

IntelliJ IDEA has an embedded terminal, which is quite useful because it opens in the root directory of the current project, and you can also open arbitrary project directories in it.

However, at present things that work in the "real" terminal don't work in the embedded one - noticeably ctrl-c for SIGINT, ctrl-a for start of line, ctrl-e for end of line, alt left/right arrow for move one word.

Is that even a solvable problem? The special casing of terminal apps seems to rely on their window handle, so it's hard to see how it would work when the terminal is only part of the application's functionality.

@Mahoney Mahoney added the question Further information is requested label May 18, 2020
@Mahoney
Copy link
Contributor Author

Mahoney commented May 18, 2020

Related - I've created an IntelliJ keymap which basically takes their macOS one and swaps meta for ctrl wherever they occur. Does that sound like the right approach? It works, mostly.

@rbreaves
Copy link
Owner

rbreaves commented May 18, 2020

Related - I've created an IntelliJ keymap which basically takes their macOS one and swaps meta for ctrl wherever they occur. Does that sound like the right approach? It works, mostly.

I think you got it right - considering the GUI layout for Kinto is actually this on the left side Super (Meta), Alt, Ctrl versus macs Ctrl, Alt, Cmd (Meta).

If you were to take the Ctrl key keymaps in your IDE and then create xkeysnail translations to go from Super (Meta) -> Ctrl then yes that would fix all of your keymaps for that particular app. And I would be happy to merge those changes into master.


As far as the embedded terminal goes I am still needing to do some tests to see if this 2nd comment about using FocusIn and FocusOut is an option..

https://unix.stackexchange.com/questions/480052/how-do-i-detect-whether-my-terminal-has-focus-in-the-gui-from-a-shell-script

I will essentially need some type of trigger to run a simple perl command against /tmp/kinto/xkeysnail/kinto.py as that is where the keymap resides while xkeysnail is running (the permanent master copy is in your ~/.config/kinto/kinto.py location and only loads when the service first begins). The perl command can quickly turn on or off the keymap needed for Terminals or GUI apps.

The design was purposeful because I had always planned to modify the keymap in real time when needed. Although some additional changes need to occur - inotify needs to be moved inside of xkeysnail instead of restart that program. There's more delay involved in restart xkeysnail for a keymap changes than what I would like - and unlike my prior xkbmap it could also lead to keys sticking. I say all that to say - even with a good trigger in place for using a terminal in an app I still need to update xkeysnail to reload the file natively inside of itself. That's the only way to ensure keys will not stick and that the transition is seamless.

#32 (comment)

@rbreaves
Copy link
Owner

@Mahoney I have now added IntelliJ remap support for Windows and Linux within the master branch of Kinto.

Come to find out detecting the terminal may not be needed because we can still remap the Super (physical Ctrl key as needed for the key terminal hotkeys, not as nice as switching to the terminal keymap but good enough imo). I will be closing this ticket but if you believe it needs more terminal functionality or anything else under IntelliJ then just let me know.

@Mahoney
Copy link
Contributor Author

Mahoney commented Sep 4, 2020

Fantastic, thanks!

Sorry, not had much time to follow up on any of this recently.

@rbreaves rbreaves closed this as completed Sep 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants