Making your Ubuntu 16.04 on the MacBook feel familiar

This write-up details the steps I took when installing Ubuntu 16.04 on a couple of macbooks that I have. It allows to obtain a reasonably similar-functioning system to the way OSX behaves, so your muscle memory is not upset when switching between the operating systems.

This write-up is a capture of what I did for my installation. It may be not enough or too much for yours. It may eat your breakfast or kill your cat. Proceed at your own risk. Make backups.

Launch the terminal

You can use Ctrl-Alt-T to launch the terminal, or press "Command" and then type "terminal" in the launcher.

IMPORTANT - install the macbook fan support

You really do not want your CPU to overheat - at best it will bring reduced performance, at worst you are risking to damage the hardware...

sudo apt install xsensors

# Change permissions for /usr/local/src
sudo chown -R $USER /usr/local/src
sudo apt install git

# Install mbpfan 
# https://ineed.coffee/3838/a-beginners-tutorial-for-mbpfan-under-ubuntu/
# you will want to modify some settings
cd /usr/local/src
git clone https://github.com/dgraziotin/mbpfan
make
sudo make install
sudo make tests
sudo cp mbpfan.service /etc/systemd/system/
sudo systemctl enable mbpfan.service
sudo systemctl daemon-reload
sudo systemctl start mbpfan.service

Launch xsensors and verify you can see all the fans and sensors. Also, edit the /etc/mbpfan.conf, and verify the changes are reflected by issuing sudo service mbpfan restart. A good way to test is to bump up the min_fan_speed from the very quiet 2000 to 4000 - you will definitely hear it!

Install compiz settings manager and gnome tweak tool

These will be needed to tweak the various keybindings. In the terminal issue the following:
sudo apt install compizconfig-settings-manager gnome-tweak-tool gnome-shell

Swap the "command" and "alt" keys

Hit the "command" key and type "tweak" in the search bar and launch the tweak tool.

There, go to "typing" bookmark and select "Alt/Win" key behavior, then select "Alt is swapped with Win"

In "Windows" select "Window action key" and select "Super".

Clean up the remaining reactions of shell on "Command" key

Hit the "alt" key (remember you have just swapped them with command) and type "compiz" in the search bar.

Select "Ubuntu Unity Plugin".

Select "Launcher" tab.

Edit the "Key to show the Dash, Launcher and help overlay" to show "<Control><shift><alt><super>".

Edit the "Key to give keyboard-focus to the launcher to show "Disabled"

Go to "General" tab and select "Key to show the menu bar while pressed" and edit it to be "disabled" from "<alt>"

Edit the "Key to lock the screen" to "<Control><alt><Super>l"

Edit the "Key to show the HUD when tapped" to show "Disabled"

Edit the "Key to execute a command" to be "<Alt><Super>space"

Edit terminal shortcuts

While in terminal, go to the top bar, and select "Edit -> Preferences" then select "Shortcuts" tab.

Edit:

"New Terminal in a tab" -> "Alt+T"
"New Terminal in a new window" -> "Alt+N" (i.e. pressing Command+N)

"Edit->Copy" -> "Alt+C"
"Edit->Paste" -> "Alt+V"
"Find->Find" => "Alt+F"
"Find->Fnid Next" => "Alt+G"

Fix the scrolling to be natural

Start the settings (icon on the left with the wrench).

Select "mouse & touchpad" and click "natural scrolling".

Fix the firefox keyboard shortcuts

Type "about:config" in the address bar.

Press "I accept the risk" (after all, you are running ubuntu on the mac already, aren't you ? :)

Then in the "search" type "unity" and hit enter. Set "ui.use_unity_menubar" to false.

Then in the "search" type "ui.key" and hit enter. Do the below:

then set "ui.key.accelKey" to 18
!- ui.key.chromeAccess to 0
!- ui.key.contentAccess to 0


"ui.key.menuAccessKey" to 16
"ui.key.menuAccessKeyFocuses" to "false"

disclaimer: you might need to not need all of these.. experiment.
Restart firefox.

Set the menu bar to be on the window

Launch preferences, Select "Appearance" and go to "Behavior" tab.

Select "Show the menus for a window" as "in the window's title bar" "menus visibility" to be "always displayed"

Install albert

docs: https://albertlauncher.github.io/docs/installing/

wget -nv -O Release.key \ 
  https://build.opensuse.org/projects/home:manuelschneid3r/public_key
sudo apt-key add - < Release.key
sudo apt-get update

sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/manuelschneid3r/xUbuntu_16.04/ /' > /etc/apt/sources.list.d/albert.list"
sudo apt-get update
sudo apt-get install albert

Launch albert and set hotkey to alt-space.

make alt-space open albert if not launched

Go to preferences. Select keyboard -> shortcuts.

Create a new shortcut called "albert" with command "albert command show" click on it and press "Alt+Space".

A warning will pop up that it is already used to activate the windows menu, click to reassign.

install dconf-editor and edit the default keybindings


sudo apt-get install dconf-editor 

mkdir -p ~/.themes/macos/gtk-3.0/
cp /usr/share/themes/Emacs/gtk-3.0/gtk-keys.css ~/.themes/macos/gtk-3.0/
$EDITOR ~/.themes/macos/gtk-3.0/gtk-keys.css

# in the gtk-keys.css file, edit the bindings as you see fit — they're pretty self-explanatory. The lines that would be of particular interest are:

bind "w" { "cut-clipboard" () };
bind "y" { "paste-clipboard" () };

# which you should change to (super is typically the "Command" key):

bind "x" { "cut-clipboard" () };
bind "v" { "paste-clipboard" () };
bind "c" { "copy-clipboard" () };

# In order to enable your new macos key theme, use gsettings:

gsettings set org.gnome.desktop.interface gtk-key-theme 'macos'
Source: http://www.weedit.de/unix/question/gnome-3-keybindings-in-source-where-are-ctrl-c-cut-copy-and-paste-defined-342628.html

Install a light OSX-like theme

Install theme from https://www.gnome-look.org/p/1171688/

Make a symlink for mounted volumes

sudo ln -s /media/${USER} /Volumes

Install MS fonts

sudo apt-get install ttf-mscorefonts-installer
sudo fc-cache -f -v
Source: https://www.ostechnix.com/install-microsoft-windows-fonts-ubuntu-16-04/

You are done!

Enjoy! and drop me a note on twitter @ayourtch if this is useful!