Skip to main content

Linuxify your Mac

Recently I got offered a MacBook Pro by my company. Little did I know that how unfriendly macOS's UX really are until I daily-drive it. So here is some lifesaving hacks such that a long time Linux user like me can use the macOS.

UI Scalingโ€‹

Mac uses a weird scaling paradigm as it mixes up resolution and UI Scaling. The best UI Scaling is to use a "Look-like" resolution of 1920x1080.

Remap keysโ€‹

The existence of ^(Ctrl in Mac), โŒฅ (Option in Mac) and โŒ˜ (Command in Mac) breaks my flow immediately. In order to keep my muscle memory, here is the key remapping if you are used to Linux(specifically Gnome)/Windows.

For both Windows/Apple Keyboard

  • Ctrl โŒƒ -> Command
  • OptionโŒฅ -> Control
  • Command โŒ˜ -> Option

Use Marta and customizeโ€‹

Mac's Finder is so bad that it is beyond saving. Just use Marta.

Here is the configuration that you should override

environment {
terminal "iTerm"
}

behavior {
actions {
core.trash.confirm false
}
layout {
showActionBar false
}
table {
iconSize 30
}
}

keyBindings {
"Cmd+X" "core.move"
"Delete" "core.trash"
"F2" "core.rename"
"F5" "core.refresh"
}

fonts {
actionBar [ "Default" 18 ]
breadcrumbs [ "Default" 18 ]
virtualTabs [ "Default Bold" 18 ]
files [ "Default" 18 ]
statusBar [ "Default Light" 18 ]
tableHeader [ "Default" 18 ]
tabs [ "Default" 18 ]
preferences [ "Monaco" 18 ]
}

Alt-Tabโ€‹

Mac does not have the corresponding feature of Alt + Tab. You are supposed to use Command + Tab then Command + `. You can install the following application to achieve the same thing. The alt-tab that switches between windows but not application. https://alt-tab-macos.netlify.app/

Configure the hotkey to be โŒฅ + Tab.

Rectangleโ€‹

The windows snapping for Mac is very anti-ergonomic.

You should install Rectangle to make it reasonable. Windows Manager that supports Window-style keyboard snapping. https://rectangleapp.com/

Set the following hotkeys

  • Super + Up : Maximize
  • Super + Down: Restore
  • Super + Left: Left Half
  • Super + Right: Right Half

Stats.Appโ€‹

The best Mac System monitor app is Stats.

You can download it from here.

Home-End Behaviourโ€‹

The Home and End button does not have consistent behaviour on Mac. The only way to make it easier to use is to set up the KeyBinding yourself. Here is the configuration that I am using.

https://cobus.io/posts/2017-02-09/osx-home-end-keys/#:~:text=This%20remapping%20does%20the%20following,start%20and%20end%20of%20document Create a file /Users/gordonlau/Library/KeyBindings/DefaultKeyBinding.dict. Put in the following content.

{
"\UF729" = moveToBeginningOfParagraph:; // home
"\UF72B" = moveToEndOfParagraph:; // end
"$\UF729" = moveToBeginningOfParagraphAndModifySelection:; // shift-home
"$\UF72B" = moveToEndOfParagraphAndModifySelection:; // shift-end
"^\UF729" = moveToBeginningOfDocument:; // ctrl-home
"^\UF72B" = moveToEndOfDocument:; // ctrl-end
"^$\UF729" = moveToBeginningOfDocumentAndModifySelection:; // ctrl-shift-home
"^$\UF72B" = moveToEndOfDocumentAndModifySelection:; // ctrl-shift-end
}

Mission Control hotkey for Snappingโ€‹

Change the hot key for Snapping to Ctrl + Up for showing mission control and Ctrl + Down for showing only the application.

Next Tab/Previous Tabโ€‹

The next tab/previous tab behaviour is not consistent across different applications.
In Windows, they are Ctrl + Page Up and Ctrl + Page Down. But in Mac, they are different for different applications. The only true consistent hotkey are

  • Command + Shift + [: previous tab
  • Command + Shift + ]: next tab

Terminal's Ctrl + C and Command + C issueโ€‹

In terminal, Ctrl+C is sending SIGINT๏ผŒโŒ˜+C is copying files. Since I have already mapped โŒ˜ to Ctrl on a Windows Keyboard. I cannot use Ctrl+C to send SIGINT.

  • Installing iTerm, set Copy and Paste to โŒ˜+Shift+C and โŒ˜+Shift+P respectively. And add โŒ˜+C to send 0x03, โŒ˜+D to send 0x04 and โŒ˜+z to send 0x1A . Use iTerm to replace the built-in terminal of Mac.
  • In vscode, set vscode to sendSequence when โŒ˜+C , โŒ˜+D and โŒ˜+z to send signal while terminal is in focus.
[
...
{
"key": "shift+cmd+c",
"command": "-workbench.action.terminal.openNativeConsole",
"when": "!terminalFocus"
},
{
"key": "shift+cmd+c",
"command": "workbench.action.terminal.copySelection",
"when": "terminalTextSelectedInFocused || terminalFocus && terminalHasBeenCreated && terminalTextSelected || terminalFocus && terminalProcessSupported && terminalTextSelected || terminalFocus && terminalTextSelected && terminalTextSelectedInFocused || terminalHasBeenCreated && terminalTextSelected && terminalTextSelectedInFocused || terminalProcessSupported && terminalTextSelected && terminalTextSelectedInFocused"
},
{
"key": "cmd+c",
"command": "workbench.action.terminal.sendSequence",
"args":{
"text": "\u0003"
},
"when": "terminalFocus"
},
{
"key": "cmd+d",
"command": "workbench.action.terminal.sendSequence",
"args":{
"text": "\u0004"
},
"when": "terminalFocus"
},
{
"key": "cmd+z",
"command": "workbench.action.terminal.sendSequence",
"args":{
"text": "\u001a"
},
"when": "terminalFocus"
}
...
]
  • If you are using IntelliJ, simply disable the terminal and open iTerm whenever you want to use Terminal. iTerm is superior than the small terminal anyway.
  • Basically you need to configure each terminal in every application to do the same. Therefore I use mostly iTerm on Mac due to this issue.