-
Notifications
You must be signed in to change notification settings - Fork 331
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
add an option for ignore layout #274
Comments
@Monirzadeh I'm not sure I understood what you want exactly but I don't think it's possible the way terminals work. We simply read the key from termbox, and termbox I think simply reads the key from the terminal. I don't think even terminals have access to the keyboard layout and simply read the key from the operating system. Where did you get this idea? |
for example this extension has an option for this situation. if you active other language has this problem too. i link some other language keyboard layout here you can use command to acsses English and Russia language (change layout with
if you don't get my point say it, i can explain by more detaile or send a screen cast |
@Monirzadeh I think I understand your point, but I don't think it's possible. The extension you provided seems to be a browser extension and browsers can somehow have access to keyboard layouts. Do you have an example of this feature implemented in a terminal application? I think you should be able to remap current defaults to the keys sent by the terminal:
|
i am not sure it can be helpful or not
sxhkd ignore my layout and execute my keybinding |
@gokcehan From docs:
E.g. in my neovim config for russian layout i simply have " handle russian in normal/selection/etc modes (interpret ш as i, etc)
" note that :help langmap seems to be slightly wrong
" , ; and \ as characters need to be escaped with 2 backslashes, not 1
" " (double quotes) also needs to be escaped in 'translate TO' (after ;) side, but only with one \
set langmap=ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯ;ABCDEFGHIJKLMNOPQRSTUVWXYZ,фисвуапршолдьтщзйкыегмцчня;abcdefghijklmnopqrstuvwxyz,юЮ;.>,бБ;\\,<,эхъ;'[],ЭХЪ;\"{} Or, if you want just the alphabet, and don't want to deal with escaping stuff set langmap=ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯ;ABCDEFGHIJKLMNOPQRSTUVWXYZ,фисвуапршолдьтщзйкыегмцчня;abcdefghijklmnopqrstuvwxyz
" which means
" interpret
" Ф as A
" ф as a
" И as B
" и as b
" ...etc
" so something like вфц is interpreted as daw (Delete Around Word), and works correctly. Also, there is a plugin for ranger that does similar thing. |
As a temporary workaround (really far from perfect, yes) i wrote this script. It generates from this
This
It translates to cyrillic by default, but it is trivial to adapt for other layouts, see usage. |
hi thanks for your response i test this command and it is work for some command but some of them not working
i get |
for now i change that from
to
to fix that |
@Monirzadeh Thanks, added, didn't even knew you could quote keys. Also fixed bug where mappings like |
@gokcehan Is it possible to lf get |
@gokcehan check this thread philj56/tofi#41 |
Sadly, it's not that simple. Tcell (which is lf's tui backend) doesn't seem to be dealing with keycodes according to dev gdamore/tcell#152 (comment) There is some mentions of keycodes in code https://github.com/gdamore/tcell/blob/68adf4676d0747934bbaa073a656ed3005972d1f/key.go#L64-L71 ...but those aren't real keycodes: example codepackage main
import (
"fmt"
"os"
"github.com/gdamore/tcell/v2"
"github.com/gdamore/tcell/v2/encoding"
"github.com/mattn/go-runewidth"
)
func emitStr(s tcell.Screen, x, y int, str string) {
for _, c := range str {
var comb []rune
w := runewidth.RuneWidth(c)
if w == 0 {
comb = []rune{c}
c = ' '
w = 1
}
s.SetContent(x, y, c, comb, tcell.StyleDefault)
x += w
}
}
// Press ESC to exit.
func main() {
encoding.Register()
s, e := tcell.NewScreen()
if e != nil {
fmt.Fprintf(os.Stderr, "%v\n", e)
os.Exit(1)
}
if e := s.Init(); e != nil {
fmt.Fprintf(os.Stderr, "%v\n", e)
os.Exit(1)
}
for {
switch ev := s.PollEvent().(type) {
case *tcell.EventResize:
s.Sync()
case *tcell.EventKey:
if ev.Key() == tcell.KeyEscape {
s.Fini()
os.Exit(0)
} else {
s.Clear()
emitStr(s, 0, 0, fmt.Sprintf("name: %v, key: %v, rune: %v", ev.Name(), ev.Key(), ev.Rune()))
s.Show()
}
}
}
} 12.28.17.2022.mp4So different layouts produce different runes and names, but |
hi
i use two layout on my system. lf not detect my shortcut in second layout.
can you add an option in lfrc to ignore keyboard layout (not in commands like rename)?
The text was updated successfully, but these errors were encountered: