geekhack

geekhack Community => Other Geeky Stuff => Topic started by: madik on Sun, 07 September 2014, 11:59:58

Title: Key remmaping software for Linux
Post by: madik on Sun, 07 September 2014, 11:59:58
I having troubles with keyboard layout on notebook that is running Linux Mint Debian edition. I am used to QWERTZ but there is no English keyboard layout with qwertz in keyboard layout settings. On windows platform I using KeyTweak software which works perfectly and I just simply swap Y with Z and its done. On linux I have no idea how and with what I could do the same thing. Any ideas? thanks!
Title: Re: Key remmaping software for Linux
Post by: dorkvader on Sun, 07 September 2014, 13:41:32
setxkbmap de

by "qwertz " I must assume you mean "german" even though a lot of different countries have a layout that includes that.

edit: if you are in czech republic, you might want to use the czech key layout. I forget the country code, probably cz or something. Read the setxbkmap manpage to see what it should be.
Title: Re: Key remmaping software for Linux
Post by: Hypersphere on Sun, 07 September 2014, 13:52:12
If you ever use a Mac, there is a great free program called Karabiner. I use this indirectly with my linux box, because I use a single keyboard with three computers (Mac, Linux, and Windows) that are linked via an Iogear KW switch and Synergy software.

However, when using my keyboard directly with linux, I either make use of the desktop manager keyboard configurator, or I use XKB or xmodmap, which has an associated gui, xkeycaps. However, I have not tested these for your particular remapping.
Title: Re: Key remmaping software for Linux
Post by: madik on Sun, 07 September 2014, 13:56:32
setxkbmap de

by "qwertz " I must assume you mean "german" even though a lot of different countries have a layout that includes that.

edit: if you are in czech republic, you might want to use the czech key layout. I forget the country code, probably cz or something. Read the setxbkmap manpage to see what it should be.
Yeah you assuming correctly. But i use mainly english layout because I code and the US layout its just better for that. For czech input I using czech qwertz layout, thats not a problem. 
I will check out the setxkbmap and see if it will do the job i need. thanks
Title: Re: Key remmaping software for Linux
Post by: madik on Sun, 07 September 2014, 14:01:09
If you ever use a Mac, there is a great free program called Karabiner. I use this indirectly with my linux box, because I use a single keyboard with three computers (Mac, Linux, and Windows) that are linked via an Iogear KW switch and Synergy software.

However, when using my keyboard directly with linux, I either make use of the desktop manager keyboard configurator, or I use XKB or xmodmap, which has an associated gui, xkeycaps. However, I have not tested these for your particular remapping.

Lots of new informations for me. Gonna check out if it will be any good for me. But not a mac user here (apple hater actually  :thumb:).
Title: Re: Key remmaping software for Linux
Post by: madik on Sun, 07 September 2014, 19:31:44
I made some progress with solving my problem. These two commands will do the job for keyswapping. But after restart its back to previous configuration. Do you know how to make the changes persistent after restart?

xmodmap -e "keycode 29 = z Z z Z"
xmodmap -e "keycode 52 = y Y y Y"
Title: Re: Key remmaping software for Linux
Post by: Hypersphere on Sun, 07 September 2014, 19:35:52
I made some progress with solving my problem. These two commands will do the job for keyswapping. But after restart its back to previous configuration. Do you know how to make the changes persistent after restart?

xmodmap -e "keycode 29 = z Z z Z"
xmodmap -e "keycode 52 = y Y y Y"
You probably need to put this information in a persistent configuration file, such as .profile in your home directory.
Title: Re: Key remmaping software for Linux
Post by: madik on Sun, 07 September 2014, 19:51:12
Ok with some more googling effort I made the changes persistent. The tips on XKB and xmodmap helped me to find the solution pretty fast. Thanks!
Title: Re: Key remmaping software for Linux
Post by: fleimi on Mon, 08 September 2014, 14:29:33


I made some progress with solving my problem. These two commands will do the job for keyswapping. But after restart its back to previous configuration. Do you know how to make the changes persistent after restart?

xmodmap -e "keycode 29 = z Z z Z"
xmodmap -e "keycode 52 = y Y y Y"

A simple program called Cron will do that for you. Read the manpage of it. Essentially, you make yourself a "crontab" and add these lines to it:

@reboot xmodmap -e "keycode 29 = z Z z Z"
@reboot xmodmap -e "keycode 52 = y Y y Y"
Title: Re: Key remmaping software for Linux
Post by: StylinGreymon on Mon, 08 September 2014, 14:53:49
I made some progress with solving my problem. These two commands will do the job for keyswapping. But after restart its back to previous configuration. Do you know how to make the changes persistent after restart?

xmodmap -e "keycode 29 = z Z z Z"
xmodmap -e "keycode 52 = y Y y Y"
You probably need to put this information in a persistent configuration file, such as .profile in your home directory.

You need to make an .Xmodmap file in your ~ directory.
Code: [Select]
$ xmodmap -pke > ~/.XmodmapThen, you can make your changes to the file and save them.
You call it with:
Code: [Select]
$ xmodmap ~/.Xmodmap
To have it called on startup, just add that last command to your .xinitrc
Title: Re: Key remmaping software for Linux
Post by: vimx on Fri, 12 September 2014, 20:41:58
I put my mouse and keyboard tweaks in a single shell  script which runs from two places.   Once at login, as a startup item, and once from the system power management script,  so things are good after it comes out of sleep.