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

Chat about keyboard remapping? #1

Open
bjohas opened this issue May 13, 2019 · 6 comments
Open

Chat about keyboard remapping? #1

bjohas opened this issue May 13, 2019 · 6 comments

Comments

@bjohas
Copy link

bjohas commented May 13, 2019

hello @mogenson

I was pointed at this repo from here: https://support.google.com/chromebook/thread/5999783?hl=en. I've been looking at keyboard remapping in chromeOS (see some notes here https://github.com/bjohas/kromos - no code yet, but happy to share a first version).

It's possible to set shortcuts that work without "focus" with the mechanism used here: https://github.com/OTL/emacs_shortcuts_ime. It's just fairly limited.

Would you be up for a chat to share some thoughts?

@mogenson
Copy link
Owner

mogenson commented Aug 1, 2019

Sorry for the wait. I just got around to looking at this now.

To trigger actions with the keyboard it seems like you can either use the chrome.input or chrome.commands APIs. chrome.input only works for focused text fields in Chrome windows. chrome.commands also only works for focused Chrome windows. Global keyboard shortcuts are supported for MacOS, Windows, and Linux, but not Chrome OS. Shortcuts can also only start with Ctrl or Alt (which works for Emacs keybindings).

Let me know if you find a way to capture keyboard events from other places like the desktop, files app, or Android apps.

@bjohas
Copy link
Author

bjohas commented Aug 8, 2019

Hi @mogenson

Many thanks for the reply - I didn't really find a way around it, so in the end kinda gave up on it.

Are you saying that extensions can use chrome.commands to send "global keyboard shortcuts", but that this doesn't work on ChromeOS?

@dstarikov
Copy link
Contributor

I found a way to achieve this functionality with better global support.

I remap the launcher key to Ctrl instead of Escape, and send the Escape key event if no other keys are pressed besides Ctrl. I then use xcape to do the same for Linux apps - this works for X11 apps, but not wayland ones.

https://github.com/dstarikov/ctrl2esc

@mogenson
Copy link
Owner

https://github.com/oblitum/caps2esc should get you similar functionality in X and Wayland Linux applications, since it uses libevdev instead of libX11.

The missing piece is capturing key events in Chrome OS when a text input field is not focused. For example, pressing caps+n at the desktop to open a new browser window.

@dstarikov
Copy link
Contributor

I cannot get caps2esc to work under Crostini - I am unable to set the niceness for it.

With my extension I am able to open a new browser window with caps+n from anywhere, including the desktop without any text input field being focused.

@mogenson
Copy link
Owner

Ok, I see the value in switching the mapping around now. You probably only want single-press esc remapping when editing text in a text input field where the IME context is valid. Elsewhere, ctrl shortcuts are more useful.

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

No branches or pull requests

3 participants