Skip to content

Instantly share code, notes, and snippets.

@bartosjiri
Last active December 22, 2024 00:09
Show Gist options
  • Select an option

  • Save bartosjiri/da83eb003bc9b1d7aeb8bd6136edbc62 to your computer and use it in GitHub Desktop.

Select an option

Save bartosjiri/da83eb003bc9b1d7aeb8bd6136edbc62 to your computer and use it in GitHub Desktop.

Revisions

  1. bartosjiri revised this gist Aug 15, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion xmodmap-macos.md
    Original file line number Diff line number Diff line change
    @@ -50,4 +50,4 @@ Xmodmap configuration that swaps <kbd>ctrl</kbd> and <kbd>cmd</kbd> keys to achi
    ```
    ## Limitations
    - This modification does not replicate the macOS terminal controls (i.e. <kbd>ctrl</kbd>+<kbd>c</kbd> to cancel). A workaround for this limitation is possible with [AutoKey scripts](hhttps://github.com/bartosjiri/autokey-macos).
    - This modification does not replicate the macOS terminal controls (i.e. <kbd>ctrl</kbd>+<kbd>c</kbd> to cancel). A workaround for this limitation is possible with [AutoKey scripts](https://github.com/bartosjiri/autokey-macos).
  2. bartosjiri revised this gist Aug 15, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion xmodmap-macos.md
    Original file line number Diff line number Diff line change
    @@ -50,4 +50,4 @@ Xmodmap configuration that swaps <kbd>ctrl</kbd> and <kbd>cmd</kbd> keys to achi
    ```
    ## Limitations
    - This modification does not replicate the macOS terminal controls (i.e. <kbd>ctrl</kbd>+<kbd>c</kbd> to cancel). A workaround for this limitation is possible with [AutoKey scripts](https://github.com/pryetranka/autokey-macos).
    - This modification does not replicate the macOS terminal controls (i.e. <kbd>ctrl</kbd>+<kbd>c</kbd> to cancel). A workaround for this limitation is possible with [AutoKey scripts](hhttps://github.com/bartosjiri/autokey-macos).
  3. bartosjiri revised this gist Aug 15, 2019. 1 changed file with 37 additions and 38 deletions.
    75 changes: 37 additions & 38 deletions xmodmap-macos.md
    Original file line number Diff line number Diff line change
    @@ -6,49 +6,48 @@ Xmodmap configuration that swaps <kbd>ctrl</kbd> and <kbd>cmd</kbd> keys to achi
    1. Open or create `.Xmodmap` file in your `~/` folder.

    2. Paste the following code into that file:

    ```
    ! -*- coding: utf-8 -*-
    ! macOS-like key mapping
    ! default mapping
    ! keycode 37 = Control_L NoSymbol Control_L
    ! keycode 64 = Alt_L Meta_L Alt_L Meta_L
    ! keycode 92 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift
    ! keycode 105 = Control_R NoSymbol Control_R
    ! keycode 108 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift
    ! keycode 133 = Super_L NoSymbol Super_L
    ! keycode 134 = Super_R NoSymbol Super_R
    ! keycode 204 = NoSymbol Alt_L NoSymbol Alt_L
    ! keycode 206 = NoSymbol Super_L NoSymbol Super_L
    ! moddified mapping
    clear control
    clear mod1
    clear mod4
    clear mod5
    keycode 37 = Super_L NoSymbol Super_L
    keycode 108 = Alt_R NoSymbol Alt_R
    keycode 133 = Control_L NoSymbol Control_L
    keycode 134 = Control_R NoSymbol Control_R
    add control = Control_L Control_R
    add mod1 = Alt_L Meta_L
    add mod4 = Super_L Super_R
    add mod5 = Alt_R Meta_R
    ```
    ```
    ! -*- coding: utf-8 -*-
    ! macOS-like key mapping
    ! default mapping
    ! keycode 37 = Control_L NoSymbol Control_L
    ! keycode 64 = Alt_L Meta_L Alt_L Meta_L
    ! keycode 92 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift
    ! keycode 105 = Control_R NoSymbol Control_R
    ! keycode 108 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift
    ! keycode 133 = Super_L NoSymbol Super_L
    ! keycode 134 = Super_R NoSymbol Super_R
    ! keycode 204 = NoSymbol Alt_L NoSymbol Alt_L
    ! keycode 206 = NoSymbol Super_L NoSymbol Super_L
    ! moddified mapping
    clear control
    clear mod1
    clear mod4
    clear mod5
    keycode 37 = Super_L NoSymbol Super_L
    keycode 108 = Alt_R NoSymbol Alt_R
    keycode 133 = Control_L NoSymbol Control_L
    keycode 134 = Control_R NoSymbol Control_R
    add control = Control_L Control_R
    add mod1 = Alt_L Meta_L
    add mod4 = Super_L Super_R
    add mod5 = Alt_R Meta_R
    ```
    3. Run the following command in terminal and compare your values with the *default mapping* values in provided `.Xmodmap` config:
    ```
    xmodmap -pke | grep -P '(Control|Super|Alt|Level3)'
    ```
    ```
    xmodmap -pke | grep -P '(Control|Super|Alt|Level3)'
    ```
    - *If your keycodes values are different, you will need to remap these by yourself. You can run `xmodmap -pke` to print out all keycodes or use `xev` utility ([help](https://wiki.archlinux.org/index.php/Keyboard_input#Identifying_keycodes_in_Xorg)).*
    - *If your keycodes values are different, you will need to remap these by yourself. You can run `xmodmap -pke` to print out all keycodes or use `xev` utility ([help](https://wiki.archlinux.org/index.php/Keyboard_input#Identifying_keycodes_in_Xorg)).*
    4. Apply the changes:
    ```
    xmodmap ~/.Xmodmap
    ```
    ```
    xmodmap ~/.Xmodmap
    ```
    ## Limitations
    - This modification does not replicate the macOS terminal controls (i.e. <kbd>ctrl</kbd>+<kbd>c</kbd> to cancel). A workaround for this limitation is possible with [AutoKey scripts](https://github.com/pryetranka/autokey-macos).
  4. bartosjiri revised this gist Aug 15, 2019. 1 changed file with 36 additions and 36 deletions.
    72 changes: 36 additions & 36 deletions xmodmap-macos.md
    Original file line number Diff line number Diff line change
    @@ -7,48 +7,48 @@ Xmodmap configuration that swaps <kbd>ctrl</kbd> and <kbd>cmd</kbd> keys to achi

    2. Paste the following code into that file:

    ```
    ! -*- coding: utf-8 -*-
    ! macOS-like key mapping
    ! default mapping
    ! keycode 37 = Control_L NoSymbol Control_L
    ! keycode 64 = Alt_L Meta_L Alt_L Meta_L
    ! keycode 92 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift
    ! keycode 105 = Control_R NoSymbol Control_R
    ! keycode 108 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift
    ! keycode 133 = Super_L NoSymbol Super_L
    ! keycode 134 = Super_R NoSymbol Super_R
    ! keycode 204 = NoSymbol Alt_L NoSymbol Alt_L
    ! keycode 206 = NoSymbol Super_L NoSymbol Super_L
    ! moddified mapping
    clear control
    clear mod1
    clear mod4
    clear mod5
    keycode 37 = Super_L NoSymbol Super_L
    keycode 108 = Alt_R NoSymbol Alt_R
    keycode 133 = Control_L NoSymbol Control_L
    keycode 134 = Control_R NoSymbol Control_R
    add control = Control_L Control_R
    add mod1 = Alt_L Meta_L
    add mod4 = Super_L Super_R
    add mod5 = Alt_R Meta_R
    ```
    ```
    ! -*- coding: utf-8 -*-
    ! macOS-like key mapping
    ! default mapping
    ! keycode 37 = Control_L NoSymbol Control_L
    ! keycode 64 = Alt_L Meta_L Alt_L Meta_L
    ! keycode 92 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift
    ! keycode 105 = Control_R NoSymbol Control_R
    ! keycode 108 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift
    ! keycode 133 = Super_L NoSymbol Super_L
    ! keycode 134 = Super_R NoSymbol Super_R
    ! keycode 204 = NoSymbol Alt_L NoSymbol Alt_L
    ! keycode 206 = NoSymbol Super_L NoSymbol Super_L
    ! moddified mapping
    clear control
    clear mod1
    clear mod4
    clear mod5
    keycode 37 = Super_L NoSymbol Super_L
    keycode 108 = Alt_R NoSymbol Alt_R
    keycode 133 = Control_L NoSymbol Control_L
    keycode 134 = Control_R NoSymbol Control_R
    add control = Control_L Control_R
    add mod1 = Alt_L Meta_L
    add mod4 = Super_L Super_R
    add mod5 = Alt_R Meta_R
    ```

    3. Run the following command in terminal and compare your values with the *default mapping* values in provided `.Xmodmap` config:
    ```
    xmodmap -pke | grep -P '(Control|Super|Alt|Level3)'
    ```
    ```
    xmodmap -pke | grep -P '(Control|Super|Alt|Level3)'
    ```

    - *If your keycodes values are different, you will need to remap these by yourself. You can run `xmodmap -pke` to print out all keycodes or use `xev` utility ([help](https://wiki.archlinux.org/index.php/Keyboard_input#Identifying_keycodes_in_Xorg)).*

    4. Apply the changes:
    ```
    xmodmap ~/.Xmodmap
    ```
    ```
    xmodmap ~/.Xmodmap
    ```

    ## Limitations
    - This modification does not replicate the macOS terminal controls (i.e. <kbd>ctrl</kbd>+<kbd>c</kbd> to cancel). A workaround for this limitation is possible with [AutoKey scripts](https://github.com/pryetranka/autokey-macos).
  5. bartosjiri created this gist May 25, 2019.
    54 changes: 54 additions & 0 deletions xmodmap-macos.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,54 @@
    # Xmodmap macOS configuration
    Xmodmap configuration that swaps <kbd>ctrl</kbd> and <kbd>cmd</kbd> keys to achieve macOS-like behaviour.


    ## Installation
    1. Open or create `.Xmodmap` file in your `~/` folder.

    2. Paste the following code into that file:

    ```
    ! -*- coding: utf-8 -*-
    ! macOS-like key mapping
    ! default mapping
    ! keycode 37 = Control_L NoSymbol Control_L
    ! keycode 64 = Alt_L Meta_L Alt_L Meta_L
    ! keycode 92 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift
    ! keycode 105 = Control_R NoSymbol Control_R
    ! keycode 108 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift
    ! keycode 133 = Super_L NoSymbol Super_L
    ! keycode 134 = Super_R NoSymbol Super_R
    ! keycode 204 = NoSymbol Alt_L NoSymbol Alt_L
    ! keycode 206 = NoSymbol Super_L NoSymbol Super_L
    ! moddified mapping
    clear control
    clear mod1
    clear mod4
    clear mod5
    keycode 37 = Super_L NoSymbol Super_L
    keycode 108 = Alt_R NoSymbol Alt_R
    keycode 133 = Control_L NoSymbol Control_L
    keycode 134 = Control_R NoSymbol Control_R
    add control = Control_L Control_R
    add mod1 = Alt_L Meta_L
    add mod4 = Super_L Super_R
    add mod5 = Alt_R Meta_R
    ```

    3. Run the following command in terminal and compare your values with the *default mapping* values in provided `.Xmodmap` config:
    ```
    xmodmap -pke | grep -P '(Control|Super|Alt|Level3)'
    ```

    - *If your keycodes values are different, you will need to remap these by yourself. You can run `xmodmap -pke` to print out all keycodes or use `xev` utility ([help](https://wiki.archlinux.org/index.php/Keyboard_input#Identifying_keycodes_in_Xorg)).*

    4. Apply the changes:
    ```
    xmodmap ~/.Xmodmap
    ```

    ## Limitations
    - This modification does not replicate the macOS terminal controls (i.e. <kbd>ctrl</kbd>+<kbd>c</kbd> to cancel). A workaround for this limitation is possible with [AutoKey scripts](https://github.com/pryetranka/autokey-macos).