Well all you need is a compizconfig-settings-manager and plugin compiz-fusion-plugins-extra

sudo apt-get install compizconfig-settings-manager sudo apt-get install compiz-plugins-extra

Open compiz on Windows Management tab, activate Extra WM actions plugin by checking the box.

set keybind action "Toggle Fullscreen" on Extra WM actions page. Log out and login again

P.S. for gnome shell use gconf or try dconf to bind key

Tested on Ubuntu 14.04 and 16.04

original text link for old versions