This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Custom keyboard layout + Custom Shortcuts for each

0

Votes
0
0
Tags: None
(comma "," separated)
witoldor
Registered Member
Posts
10
Karma
0
Hello,
Wouldn't it be nice to have an ability to switch between keyboard layouts and have some useful functionalities bound to each?
Like in Vim editor, Insert mode, view mode, normal mode etc.

My Idea is to switch with for example left alt + space between two custom keyboard layouts (this function exists, I know ;) ).

First layout - normal layout:

Second layout - custom layout lets call it (Moving layout):
1. I want to have arrows under j+k+l+i
2. pgup and pgdown under u+o.
3. d - will delete line
4. c - copy some stuff
5. under each number 123456789 ability to switch between programs.
6. etc.

To achieve that:
1. In KDE global shortcuts, keybinds should have additional switcher to enable or disable for chosen keyboard layout.
2. Add some Graphical Custom keyboard layout creator
koffeinfriedhof
Registered Member
Posts
608
Karma
4
OS
There are already methods to achieve this. But this is not really plasma-related as the basic mapping is done before a graphical environment is loaded and is even possible in a pure tty (via loadkeys).
Have a look at /usr/share/X11/xkb/symbols to get an idea of how these mappings are done in GUI environment (wayland also uses xkb). For only minor changes there is xmodmap.

Your approach could be easily achieved with one layout only. Create an eight level layout based on your ideas and use a level_5_lock-Key to switch modes. I'm using the scroll key as level_5_shift and NumLock as level_5_lock to get there, as I have caps lock already made an hyper-key which basically is bound to window and project switching and listing.

You could also use a kind of homerow-mod or custom (makro) keyboard stuff to even enhance this.

A great place to start reading is https://www.win.tue.nl/~aeb/linux/kbd/
witoldor
Registered Member
Posts
10
Karma
0
@koffeinfriedhof Thanks for directions! :)
I m kinda a little bit greenhorn with ASCII, keycodes and keysymbols, Bios and low level programming.

I tried to copy one of /usr/share/X11/xkb/symbols/*
but when I opened it I don't get this:
key <AD01> "symbols" and how it really works. [couldn't find even arrow keys] I will read about it for sure and follow ur instructions.

Having no enough knowledge in the Topic of keybindings, "low level" or "system level" I can't asses whether it even can be done via KDE System for ease of use for greenhorns like me. But I feel that would be pretty powerfull and increase efficiency of workflow.

Thanks for lecture and if u have some more references needed to understand the topic of keybinds, keyboards and some scripts for linux I will follow all links. ;)
koffeinfriedhof
Registered Member
Posts
608
Karma
4
OS
The link is basically about how the keyboard works. The keyboard itself produces scancodes, the bios/uefi maps it first. linux disables this and brings his own mappings, the gui environment maps the terminal mapping, etc. Not that easy at all and system dependend, at least for the virtual terminals.

Some links to understand what exactly? Depending on what you want to do, there could be a lot of links and/or scripts.
For the beginning you can use `showkeys` on tty, `xev` in X and `wev` on wayland to get the keycodes you need to change your layout. <AD01> is just a name for a position. AD is the row, the number the nth key on this row. If you create your own file and not a sublayout, you also have to take care of adding it to the evdev.xml to have it visible in your gui-environment.

Keybindings are not handled there. They are defined in, e.g. the virtual terminal code or in plasma using the kglobalaccel-stuff.

Just start playing around with the basic mapping of X. Take a language you're not using, change stuff there and try it using `setxkbmap` and make sure you have either another terminal instance with a sleep timer or a graphical option to switch the layout back in case you messed something up. So you do not end without a input method ;)
If you have exact questions, ask them. I'll try to explain as far as I understand it myself ;)
witoldor
Registered Member
Posts
10
Karma
0
@koffeinfriedhof Sheesh!! xD. You opened my eyes for complicated problem (now its not just 'hmm just add custom keyboard layout and its done'). I Appreciate it and its time to long reading evenings than :).

so basically it is possible to add handling that stuff via system but its a hell of a work cuz there s a lot of variations for each device that need to be handled etc. Faster is to create some scripting for certain device. Well I m into it but unfortunatly atm of the time atm cuz of work :(.

I saved ur answer and take care :)

Cheers!
koffeinfriedhof
Registered Member
Posts
608
Karma
4
OS
But it is definitely worth it. I'm using a custom layout for years now, adding and removing some chars now and then. The last big update were some unicode chars. The next big update is in progress, because the modern laptops have at least 9 buttons less than my oldie goldie.
I'm now logging my keypresses and try to create one of those '36 keys layout'. At least for the most used keys.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]