How to change / swap behavior of Ctrl, Alt, Win, and fn keys?

532 views
Skip to first unread message

Tao Effect

unread,
Aug 5, 2017, 8:15:26 PM8/5/17
to qubes-users
Dear list,

Does anyone have any suggestions on how I might go about changing the behavior of the keys mentioned in the subject?

I'm so very used to the OS X keymap and it is, I think, unnecessarily painful having to switch between different keyboard layouts.

I would love to remap keys as follows:

Ctrl => fn
Alt => Ctrl
Win => Alt
fn => Win

Any help appreciated!

Thanks so much,
Greg

--

Please do not email me anything that you are not comfortable also sharing with the NSA.

signature.asc

Connor Page

unread,
Aug 6, 2017, 9:43:40 AM8/6/17
to qubes-users
AFAIK fn does not emit a code and bios will process it only in combinations with predefined keys. other keys can probably be remapped. but from my exprience I failed to swap fn and ctrl.

Robin Schneider

unread,
Aug 6, 2017, 10:37:43 AM8/6/17
to qubes...@googlegroups.com
On 08/06/2017 03:43 PM, Connor Page wrote:
> AFAIK fn does not emit a code and bios will process it only in combinations with predefined keys.

That is also how I observed it.

> other keys can probably be remapped. but from my exprience I failed to swap fn and ctrl.

Depends on the laptop model. The keyboard is handled by the embedded controller
which typically runs proprietary firmware. But that does not prevent people from
modifying it anyway :)

https://github.com/hamishcoleman/thinkpad-ec/pull/32

--
Live long and prosper
Robin `ypid` Schneider -- https://me.ypid.de/

Unman

unread,
Aug 6, 2017, 1:51:36 PM8/6/17
to Tao Effect, qubes-users
On Sat, Aug 05, 2017 at 05:15:22PM -0700, Tao Effect wrote:
> Dear list,
>
> Does anyone have any suggestions on how I might go about changing the behavior of the keys mentioned in the subject?
>
> I'm so very used to the OS X keymap and it is, I think, unnecessarily painful having to switch between different keyboard layouts.
>
> I would love to remap keys as follows:
>
> Ctrl => fn
> Alt => Ctrl
> Win => Alt
> fn => Win
>
> Any help appreciated!
>
> Thanks so much,
> Greg
>

Hi Greg,

As others have said, the Fn key is usually set in BIOS - if your machine
supports it you may find that you are able to swap keys there. (On my
Thinkpad you can do this, and it's also an option on some HPs.)

For the other keys, the simplest method would be to use xmodmap.
First, dump the existing keycodes.
'xmodmap -pke > ~/.xmodmap'

Then edit the file, swapping the entries as appropriate.
You can test the new settings by:
'xmodmap ~/.xmodmap'

To avoid doing this manually, you can add this command to .xinitrc - in my
experience that doesn't work in Qubes, but you can achieve the desired
effect by adding the line to .bash_profile.

Because of the BIOS constraints on the Fn key, you may find that you
have to implement swap FN-Ctrl in BIOS, and then remap Ctrl to Win using
xmodmap.

A major issue that you'll encounter is that individual qubes no longer
seem to inherit from dom0. (i think they used to.) That means that
you'll need to make this change in each qube AND i don't know how those
qubes will cope with the BIOS key swap, but it's worth a try.

unman

Vít Šesták

unread,
Aug 7, 2017, 11:21:16 AM8/7/17
to qubes-users
AFAIK most laptops handle Fn key in firmware, but Macs do it in OS.

If you remap Fn key in BIOS, it should be transparent to the OS, so it should be applied to all domains.

The Xmodmap works on too high level, so you need to apply to all the VMs. I've tried few ways of remapping keys in dom0 transparently to all other domains, but I've failed. Some experiments with xdotool looked promising, but I was unable to get rid of some weird effects like sticky keys and spurious modifier keyup. (Well, I was able to get rid of some of them. But then, some other issue has appeared.) But this one looks the closest to the desired result.

Regards,
Vít Šesták 'v6ak'

railr...@gmail.com

unread,
Jul 28, 2018, 7:59:50 AM7/28/18
to qubes-users
Is it possible that any1 knows a proper method to achive permanent change of ctr to shit , alt to be ctrl , and "m" to be Alt ??? Please how to do it in win7 or bios ??? AutoHotKey does not satisfy in solving this problem, so pls don't recomend it.
Reply all
Reply to author
Forward
0 new messages