djpohly / dwl

dwm for Wayland - ARCHIVE: development has moved to Codeberg
https://codeberg.org/dwl/dwl
Other
1.94k stars 284 forks source link

Keys not work on another layout #379

Closed neuromagus closed 1 year ago

neuromagus commented 1 year ago

Info

dwl version: 0.4 (git) wlroots version: latest

If I change layout, all keys with LOGO/ALT not work. Need add keycode or some mechanism.

P.S. SwayWM and RiverWM have a solution and options in config.

krypciak commented 1 year ago

What do you mean by a layout? A keyboard layout? Tiling layout (floating, monocle, etc.)? By all keys you mean keybindings? Can tell us more about the solution used in Sway/River?

neuromagus commented 1 year ago

'ru', 'es', 'fra' etc... Language (not 'us'). Need some univesal keycodes for keys. Or in another Layout u dont change a workspace.

By all keys you mean keybindings?

Yes.

A keyboard layout?

Yes.

neuromagus commented 1 year ago

Can tell us more about the solution used in Sway/River?

bindsym --to-code in Sway

Freud in RiverWM create hack... Here: https://github.com/riverwm/river/pull/753 or not... I forgot (I create issue in RiverWM too and guys fix this behavior ;)) But not found today.

And I use custom Dvorak for US and Custom Russian Typewriter for RU. Default location of keys did not match... (QWERTY etc)

krypciak commented 1 year ago

I have made a hack that switches the keyboard layout to qwerty us when a mod key is pressed (except shift). After it's released, it goes back to the previous layout. You can also set a keybining to switch the layout. Would you like a patch for that? This also makes stuff like CTRL+C and CTRL+V work for other apps

neuromagus commented 1 year ago

Thanks for fast answer and trying fix this problem.

nope... I dont use copy/paste in keys ;). I use select/middle button of mouse. I use patched version of xkb (I create personal layout for programming).

And my accords or macros did not work (I think).

So, I think, need complex solution of any languages and custom keybindings. All people different. Freud in RiverWM create Array of every keys and keycodes... But in WLROOTS 16 maybe add something, I dont know (Freud committer in WLROOTS).

Most my coworker and friends uses another layouts (Colemac, Workman, Neo etc) and use 2-3 languages (and special symbols UTF-8: Š, Ü, ß)...

krypciak commented 1 year ago

Any keyboard layout with any language would work. It doesn't matter that you have a custom keyboard layout. Example:

Your default keyboard layout is dvorak
Press CTRL, keyboard layout changes to qwerty (or any of your choise)
Press F, The client goes fullscreen
Release F and CTRL
Keyboard layout goes back to dvorak (or any of your choise)

In this case only 1 keybinding definition is needed, and will work for all layouts.

That workes for me, and I don't see any reson why it wouldn't work for you.

neuromagus commented 1 year ago

))) Why not? Let's try )) But... my CTRL in another place ;) I use Emacs and I crack my HHKB to 40% keyboard with layers (hello, 'Neo' - https://neo-layout.org). So... All my keys changed. ALT, CAPS, ESC, CTRL, LOGO(WIN) - all this keys are rebinded.

For example (Space Cadet - Emacs default https://upload.wikimedia.org/wikipedia/commons/thumb/4/47/Space-cadet.jpg/1920px-Space-cadet.jpg) CTRL -> ALT ALT -> LWIN CAPS -> ESC RALT -> Layer1 RWIN -> LWIN (LOGO)

krypciak commented 1 year ago

What the hell. It is possible to do this. You would first need to pick a keyboard layout and write your keybindings for it. What keyboard layouts do you use? How different are they form each other?

neuromagus commented 1 year ago

How different are they form each other?

Yep ;))) Totally different. For example, this ver 0.001. Later I change all special keys and some layers... version1-0

And my improved Dvorak works well on River and Sway. But I prefer DWM (Xmonad). Wayland come... RHEL 9 use Wayland default (and FF native), Debian BookWorm - Wayland default...

krypciak commented 1 year ago

Is this the only keyboard layout you use?

neuromagus commented 1 year ago

US, RU. And yes.

Another WM works fine.

krypciak commented 1 year ago

Alright, so I assume that both layouts you use share the same mod key placements. All you need to do is make keybindings that work for the US layout, and I'll prepare a patch that allows you to switch between the layouts and keep the US keybindings for a RU layout.

neuromagus commented 1 year ago

Alright, so I assume that both layouts you use share the same mod key placements. All you need to do is make keybindings that work for the US layout, and I'll prepare a patch that allows you to switch between the layouts and keep the US keybindings for a RU layout.

Ohoh... Sorry for that, but... If DWL later change DWM - u take a fat user base (DB). And maybe need fix this on keycodes, not listen symbols? This is my config of keyboard inkl.tar.gz

krypciak commented 1 year ago

Actually, I'm dumb. Take a look at this patch: https://github.com/djpohly/dwl/wiki/keycodes. It might just do what you want all along.

neuromagus commented 1 year ago

holy!.. Wow, thanks. Actually - 'dumb' - its me. I use 3 patches and not see this... Crap. Thanks, after testing I close this issue.

I read patch, keysum changed on keycode in dwl.c. Thats enough for me.

Best regards, Krypciak.

neuromagus commented 1 year ago

Ah, and my Eng is terrible, so please, add link on this patch (or say to merge this patch in master branch in Discord) in README, Wiki (key section) or somewhere in documentation.

neuromagus commented 1 year ago

I try patch https://github.com/djpohly/dwl/wiki/keycodes. Not working properly. In keys.h codes added only for QWERTY layout. In Dvorak all keys are drop. (or need rewrite keys.h, but how to be in Colemac or another layout?)

IMO, need something for all keymaps (maybe use xkb, without any external hacks?)

sevz17 commented 1 year ago

I try patch https://github.com/djpohly/dwl/wiki/keycodes. Not working properly. In keys.h codes added only for QWERTY layout. In Dvorak all keys are drop. (or need rewrite keys.h, but how to be in Colemac or another layout?)

keys.h is only a helper, even if you use another layout (and/or variant), you can use it as reference for your keybindings.

IMO, need something for all keymaps (maybe use xkb, without any external hacks?)

I just updated the patch, I included the program I used to generate keys.h