Choose style:

Author Topic: Permanently swapping Control and Command Keys [SOLVED]  (Read 485 times)

0 Members and 1 Guest are viewing this topic.

Offline kimtoufectis

  • Jr. Member
  • **
  • Posts: 34
  • Karma: 2
  • New Forum User
    • View Profile
  • Peppermint version(s): 7
Permanently swapping Control and Command Keys [SOLVED]
« on: October 11, 2017, 05:57:36 pm »
Hello community...

As a Mac user (both on work and home machines) I am constantly activating the menu when trying to copy, paste, delete, search within, or print  selected material, set a bookmark, or refresh my browser.  This happens because Macs use the Command and Control keys for the opposite purposes as with Windows and Linux machines.  A similar solved post yielded a proposal to

Code: [Select]
gedit ~/.config/peppermint-control-center/xbindkeys.conf
and while I am minimally savvy enough to edit a file with adequate instructions, I didn't see what in the displayed file to edit to swap the function of these two keys.

So if I've adequately articulated the problem, I'll move on to my goal:  to have the Control key activate the menu, and have either of the Command keys (just left and right of my space bar) combine with c, d, f, p, r, v, or x to copy, bookmark, find, print, refresh, paste, or delete selected material, on a persistent basis.  (Might there be an app for that?)

[In case it's relevant I'm (otherwise contentedly) using P8 on an early 2006 32-bit Polycarbonate Intel iMac (yes, admittedly it and I are quite the fossils I know).]
« Last Edit: October 13, 2017, 11:03:34 pm by kimtoufectis »

Online murraymint

  • Trusted User
  • Veteran
  • *****
  • Posts: 1689
  • Karma: 282
  • soft boiled with a yolk of gold
    • View Profile
  • Peppermint version(s): 7, 8, 9
Re: Permanently swapping Control and Command Keys
« Reply #1 on: October 11, 2017, 06:30:41 pm »
I don't think xbindkeys is the right way to go about it.

Running a couple of xmodmap commands at boot or login to remap those keys is a better idea. I'm not sure of the exact keycodes but see if this helps:

https://askubuntu.com/questions/131900/how-do-i-switch-the-command-key-and-control-key-on-a-macbook-pro



Offline kimtoufectis

  • Jr. Member
  • **
  • Posts: 34
  • Karma: 2
  • New Forum User
    • View Profile
  • Peppermint version(s): 7
Re: Permanently swapping Control and Command Keys
« Reply #2 on: October 13, 2017, 01:21:57 am »
Thanks for this.
  • The first answer assumes knowledge beyond my ken; no idea how to follow it
  • The second and fourth didn't match any of the P8 "Layout Options" on my machine; apparently these instructions applied to an earlier version of Peppermint
  • The third caused me to disable the Control key function so I couldn't close and save changes to the file it asked me to edit in nano
  • The fifth got close, restoring the Control key function on the Alt key rather than the Command key
  • The sixth also provided insufficient information for me to proceed

...so I didn't quite get there.  I'm not savvy at this stuff but willing to follow instructions...

Online murraymint

  • Trusted User
  • Veteran
  • *****
  • Posts: 1689
  • Karma: 282
  • soft boiled with a yolk of gold
    • View Profile
  • Peppermint version(s): 7, 8, 9
Re: Permanently swapping Control and Command Keys
« Reply #3 on: October 13, 2017, 09:45:15 am »
OK, for the first one you would open the terminal and enter:
Code: [Select]
gedit ~/.Xmodmap
then paste this into the editor:

Code: [Select]
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
Save and exit.

Now run this in the terminal:
Code: [Select]
xmodmap ~/.Xmodmap

Do your keys swap as you want them to?

Offline kimtoufectis

  • Jr. Member
  • **
  • Posts: 34
  • Karma: 2
  • New Forum User
    • View Profile
  • Peppermint version(s): 7
Re: Permanently swapping Control and Command Keys [SOLVED]
« Reply #4 on: October 13, 2017, 12:23:24 pm »
In one try.  Thanks for the clear instructions!

Online murraymint

  • Trusted User
  • Veteran
  • *****
  • Posts: 1689
  • Karma: 282
  • soft boiled with a yolk of gold
    • View Profile
  • Peppermint version(s): 7, 8, 9
Re: Permanently swapping Control and Command Keys
« Reply #5 on: October 13, 2017, 01:56:37 pm »
Good news but you'll have to make it permanent.

Go to the main menu at the left of the panel, then Settings > Peppermint Settings Panel > System > Default applications

Click on Autostart at the left. Under Manual autostarted applications, in the text box put

Code: [Select]
xmodmap /home/YOURUSERNAME/.Xmodmap
Obviously replace YOURUSERNAME with your exact user name as it appears in Peppermint.
Then click on the Add button with the green + sign. That should make the keys swap every time you boot.

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 21676
  • Karma: 2436
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 8 Respin & 9 Alpha
Re: Permanently swapping Control and Command Keys
« Reply #6 on: October 13, 2017, 03:10:50 pm »
No he shouldn't need to do anything more to make it permanent .. ~/.Xmodmap is actioned automatically at login if it exists ;)

There should be no need to autostart it.
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Online murraymint

  • Trusted User
  • Veteran
  • *****
  • Posts: 1689
  • Karma: 282
  • soft boiled with a yolk of gold
    • View Profile
  • Peppermint version(s): 7, 8, 9
Re: Permanently swapping Control and Command Keys
« Reply #7 on: October 13, 2017, 03:35:12 pm »
Ah, okay, I was just going by what the Ubuntu forum answer was saying, cheers :)

@kimtoufectis, please edit your first post to mark the entire thread as [SOLVED], thanks  ;)

Offline kimtoufectis

  • Jr. Member
  • **
  • Posts: 34
  • Karma: 2
  • New Forum User
    • View Profile
  • Peppermint version(s): 7
Re: Permanently swapping Control and Command Keys
« Reply #8 on: July 28, 2018, 10:41:09 pm »
OK, for the first one you would open the terminal and enter:
Code: [Select]
gedit ~/.Xmodmap
then paste this into the editor:

Code: [Select]
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
Save and exit.

Now run this in the terminal:
Code: [Select]
xmodmap ~/.Xmodmap

Do your keys swap as you want them to?

These instructions worked like a charm last year when I was running Peppermint 8, but I've recently upgraded to Peppermint 9 this sequence of commands didn't produce the same outcome.  This time they seem not to have swapped the control and command keys as intended, but instead to have disabled each.  [Left-click still brings up a dialog box that does the job.]   Is there a change in Peppermint that would explain this, and in any case how can I get to this outcome?

Edit:  As I play with it a bit I find that the Command key to the right of the space bar is working as the Control  key would, just not the Command key to the left of the space bar.
 So it's closer than I initially thought.
« Last Edit: July 29, 2018, 12:10:33 am by kimtoufectis »

Online murraymint

  • Trusted User
  • Veteran
  • *****
  • Posts: 1689
  • Karma: 282
  • soft boiled with a yolk of gold
    • View Profile
  • Peppermint version(s): 7, 8, 9
Re: Permanently swapping Control and Command Keys [SOLVED]
« Reply #9 on: July 29, 2018, 12:38:30 am »
Can you run this command in a terminal:

Code: [Select]
xev

then press the left Command key and see if a keycode appears in the terminal window. You can press Ctrl-C to end xev.


Also try going into the Peppermint Control Centre, Keyboard Shortcuts tab. Find the entry for Super_L and double-click it, then Delete. Reboot to test. Does that make any difference to the Command key?
« Last Edit: July 29, 2018, 12:57:15 am by murraymint »

Offline kimtoufectis

  • Jr. Member
  • **
  • Posts: 34
  • Karma: 2
  • New Forum User
    • View Profile
  • Peppermint version(s): 7
Re: Permanently swapping Control and Command Keys [SOLVED]
« Reply #10 on: July 29, 2018, 08:01:23 am »
Also try going into the Peppermint Control Centre, Keyboard Shortcuts tab. Find the entry for Super_L and double-click it, then Delete. Reboot to test. Does that make any difference to the Command key?

This change resolves the matter as intended.  Thanks!

Online murraymint

  • Trusted User
  • Veteran
  • *****
  • Posts: 1689
  • Karma: 282
  • soft boiled with a yolk of gold
    • View Profile
  • Peppermint version(s): 7, 8, 9
Re: Permanently swapping Control and Command Keys [SOLVED]
« Reply #11 on: July 29, 2018, 10:48:04 am »
Great news  :)