Custom shortcuts toggle your control. same method and its been functioning faster as plasma versions progress

:upside_down_face:

Dependency: Install xdotool package.

$ cat ~/mapfiles/first.map
keycode 105 = F13

$ cat ~/mapfiles/second.map

keycode 105 = Control_L NoSymbol Control_L

$ cat initiate.sh
xmodmap ~/mapfiles/first.map

$ cat initiate2.sh
xmodmap ~/mapfiles/second.map

$ cat initiate3.sh
xdotool keydown ctrl &&
xmodmap ~/mapfiles/xdotoolscript.sh

$ cat ~/mapfiles/xdotoolscript.sh
keycode 105 = F15
keycode 47 = F16

$ cat ~/mapfiles/xdotoolscript2.sh
xdotool keyup ctrl &&
xmodmap ~/mapfile/xdotoolscript3.sh

$ cat ~/mapfiles/xdotoolscript3.sh
keycode 105 = F13
keycode 47 = F14

make four new custom global shortcut commands
hit the edit button > new > global shortcut > command / URL

Have this ready,
Check and change the windowbehavoir option from kmenu launcher. In the first tab, for window behavoir focus, use focus follow mouse and apply and ok.

a terminal window open at ~/mapfiles/
you will need to type ‘xmodmap initiate2.map’ a few times to enter the correct triggers for
rightctrltoggle and rightctrlrestore but not yet.

start to fill out custom shortcuts,
mappinginit2 - trigger set it to Alt-2 - with this action: sh ~/mapfiles/initiate2.sh
(this can be the script itself actually…) Hit apply to save the setting.

Double check and change the windowbehavoir option from kmenu launcher. In the first tab, for window behavoir focus, use focus follow mouse and apply and ok.

rightctrltoggle another trigger that needs to load the custom keys and function before setting it so in the terminal xmodmap first.map. Set trigger as the right control(the first press) to toggle. and fill in the third tab with sh ~/mapfiles/initiate3.sh

Press Apply each time when setting the keys. And then after this step hit Alt+2 to revert the keyboard map with xmodmap shortcut we just made in the first custom shortcut. Or in the terminal xmodmap second.map. (If there was a mistake You will have to get to ttyl console kill Xorg and begin again if the control is stuck.).

rightctrlrestore - this trigger needs to initiate the custom keys and function. in the terminal xmodmap first.map then set the trigger as the right control EXCEPT a second press to toggle. Again. inititate xmodmap first.map in terminal. Hit control. then set the trigger by clicking on trigger set button. And Hit control and it should be set at Control + Function#. It shouldnt be only control… The action should be set as sh ~/mapfiles/xdotoolscript3.sh.

Press Apply. And hit the shortcut Alt+2 again to restore keyboard mapping back to default.

mappinginit trigger set it Alt+1 and action to be: sh ~/mapfiles/init1.sh And this will toggle the toggeable right control key.

That’s it.

visual reference see here: Untitled on Tumblr

edit again. there is something wrong in my steps possibly with setting the revert. I will take some time to review it later when I find exactly the problem but fiddling with it should give a person enough bearings to see it through…

1 Like

Formatting the code blocks will make it easier to read and copy commands