Emacs fullscreen and Fedora 19

I was using fullscreen.el for so long but now that doesn’t seem to work on Fedora 19 / GNOME 3.8.1.

What to do? Following are the steps I did for now.

First install wmctrl:

$ sudo yum install wmctrl

Now add following code to your .emacs configuration file:

(defun switch-full-screen ()
  (shell-command "wmctrl -r :ACTIVE: -btoggle,fullscreen"))

(global-set-key [f11] 'switch-full-screen)

Restart Emacs and press F11. Thats it!