qutebrowser-extensions icon indicating copy to clipboard operation
qutebrowser-extensions copied to clipboard

Idea: keymap/xkbswitch analogue

Open Mikle-Bond opened this issue 5 years ago • 6 comments

When using more than one keyboard layout within QB, writing text can be a hassle. Vim also has such problems, as well as several solutions, such as embedded keymap/iminsert settings, or external plugin vim-xkbswitch (you can read it's readme to get a better idea of what I'm talking about).

Basically, I wish to port vim-xkbswitch to qutebrowser-extensions. Or, at least, have some substitution for it.

It seems like minimal requirement is API should provide means to connect to mode_manager's signals entered and left for this to work. Probably also some other changes to support helping in //?-search.

Mikle-Bond avatar Feb 20 '19 23:02 Mikle-Bond

@Yodzorah , in my experience, this problem arises when user combines mode-based app (such as QB or vim) with multiple keyboard layouts. And these "conditions" are pretty cross-platform (i.e. I have had those problems in Windows too, when I tried vim under Msys2).

On the other hand, fcitx also seems to require some kind of plugin to smooth some edged with mode-based programs. And has the same requirements on the API.:smile:

Mikle-Bond avatar Mar 19 '19 17:03 Mikle-Bond

as I've heard, but the plugin author wanted to do the same also for vim modes

he wants to actually extend vim functionality.

So do I. I'm sorry if due to my lack of English vocabulary I couldn't express this point clearly.

The README of vim-xkbswitch seem to explain this a lot more clearly than me:

Vim plugin XkbSwitch can be used to easily switch current keyboard layout back and forth when entering and leaving Insert mode. Say you are typing some document in Russian and have to leave Insert mode: when you press <Esc> your keyboard layout switches to US/English automatically. When you further enter Insert mode once again the Russian keyboard layout will be automatically switched back!

The xkbswitch by itself is a cross-platform library for managing keyboard layouts. All I want is an extension for QB to interact with it.

P.S. Truth to be told, I already use this as a dirty-hacked patch on my local installation of QB. Looking through that code today, it seem like I was really raged off by this issue and didn't really paid attention to the quality of code. :blush: Just thought that one day I'd better rewrite it from scratch, when extensions get supported.

Mikle-Bond avatar Mar 19 '19 18:03 Mikle-Bond

P.S. Truth to be told, I already use this as a dirty-hacked patch on my local installation of QB.

@Mikle-Bond Works very nicely, thanks for sharing. I intended to implement something similar on my own, but found this topic. I've extended the feature to passthrough mode (in addition to insert mode).

In what sense do you consider it dirty-hacked? The only problem with xkb-switch is that it does not work in some (all?) Wayland-based window managers such as Sway. That's the major point that keeps me from switching to Sway entirely, as I can't use xkb-switch plugin in vim there.

Galicarnax avatar May 15 '20 10:05 Galicarnax