Monday, May 6, 2024
86
rated 0 times [  86] [ 0]  / answers: 1 / hits: 131201  / 1 Year ago, thu, march 16, 2023, 11:10:11

I have scoured the web, and I can't seem to get Xmodmap / anything to work properly. I want to swap BOTH my Command keys with my Control key - in essence, inverting what they do currently.


How would I do that?


I tried xmodmap -e "keycode 133 = Control_L" and corresponding commands for keycodes 134 (right command) and 37 (control left). I even tried these commands, plus xmodmap -pke > ~/.Xmodmap and xmodmap ~/.Xmodmap in .xinitrc.


My end goal is I want HUD / Dash to come up when I click control and command to functional control, i.e., control-v is a commond shortcut to paste, i would click command-v


More From » keyboard-layout

 Answers
6

I figured it out. Put the following in ~/.Xmodmap:



clear control
clear mod4

keycode 105 =
keycode 206 =

keycode 133 = Control_L NoSymbol Control_L
keycode 134 = Control_R NoSymbol Control_R
keycode 37 = Super_L NoSymbol Super_L

add control = Control_L
add control = Control_R
add mod4 = Super_L


To test, run the command:



xmodmap ~/.Xmodmap


To make it run every time, add it to Startup Applications.



This should work on any MacBook Pro; the issue was that Xmodmap was assigning Super_L to the left and right command keys, and Control_L to the left control key. For some reason, by default, Ubuntu thinks that the MacBook Pro has a standard 105 key keyboard (probably thinking about the full Apple Keyboard) but that is wrong. Anyway, I reassigned the keycodes to the right keysims, then assigned the keysims to control and mod4.


[#38734] Friday, March 17, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
poous

Total Points: 81
Total Questions: 101
Total Answers: 119

Location: Cambodia
Member since Sat, Oct 3, 2020
4 Years ago
;