You are not logged in.

#1 2023-07-17 11:16:42

TempusNemini
Member
From: Moon
Registered: 2023-07-16
Posts: 17

MacBook keyboard: mapping for option/control

Hello!
I would like to know if it's possible to map Control-key to Option-key (so Option works as Control) from command line or in i3 environment.
In fact i'm interesting how i can switch all possible combinations with fn / control / option / cmd, as i moving now from DE to WM and still need to find out best solution for my fingers :-)
I tried to change /usr/share/X11/kbd/symbols/pc:
key <ALT> {[ Control_L, Control_R ]}
key <META> {[ Control_L, Control_R ]}
but it doesn't make any changes.

Thanks in advance!

Offline

#2 2023-07-20 18:20:53

ZonicTrout
Member
Registered: 2023-07-20
Posts: 24

Re: MacBook keyboard: mapping for option/control

I actually do something quite similiar with i3, but not with a Mac. If you want to map keybinds to specific actions (launching applications, entering modes, etc) you need the keysym. you can get this by using xev.
it should be installed along with xorg, but if not just

 sudo pacman -S extra/xorg-xev 

it should launch a window, so select it, and press any key you wish to use. For example Left shift on my conputer returns

KeyPress event, serial 34, synthetic NO, window 0x3800001,
    root 0x7eb, subw 0x0, time 48415998, (1806,1175), root:(1825,1194),
    state 0x0, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 34, synthetic NO, window 0x3800001,
    root 0x7eb, subw 0x0, time 48416142, (1806,1175), root:(1825,1194),
    state 0x1, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False 

In this case, the keycode would be 50, and in your i3 config file (usually ~/.config/i3/config), put

 bindcode 50 exec <action you want> 

or you can use bindsym (what I do) for a much more readable

 bindsym Shift_L exec <action you want> 

Note: If you don't want to have it execute a command, do not  use the keyword exec

more help:
https://faq.i3wm.org/question/1676/shor … uts.1.html
https://www.reddit.com/r/i3wm/comments/ … vs_keysym/

hope this helps!

Offline

#3 2023-07-22 14:48:42

TempusNemini
Member
From: Moon
Registered: 2023-07-16
Posts: 17

Re: MacBook keyboard: mapping for option/control

ZonicTrout wrote:

hope this helps!

Thanks for reply, will check links you've provided.
My biggest pain in the hole now: how to make right "option" key works as "control". I've tried with xmodmap, with changing layout in pc file, setxkbdmap options (last one worked, but for both left and right pairs of ctrl/option, which is not exactly what i need).

Also i will try to use CAPS_LOCK as additional control for a while, who know - may be i find it comfortable enough.

Last edited by TempusNemini (2023-07-22 14:55:04)

Offline

Board footer

Powered by FluxBB