Emacs transparency with mouse wheel

Emacs is playing fancy on the latest version (since emacs 23) it has now support for transparency at least on Linux when you have a composited Windows Manager.

As explained on the Emacs wiki here everything is controlled by this frame parameter like this :

 (set-frame-parameter (selected-frame) 'alpha '(85 50))

I have automated the thing to allow the transparency to increase or decrease when combined with the alt key just put this code somewhere in your $HOME/.emacs or $HOME/.emacs.d/init.el :

(defun my-increase-opacity()
  (interactive)
  (let ((increase (+ 10 (car (frame-parameter nil 'alpha)))))
    (if (> increase 99)(setq increase 99))
    (set-frame-parameter (selected-frame) 'alpha (values increase 75)))
)

(defun my-decrease-opacity()
  (interactive)
  (let ((decrease (- (car (frame-parameter nil 'alpha)) 10)))
    (if (< decrease 20)(setq decrease 20))
    (set-frame-parameter (selected-frame) 'alpha (values decrease 75)))
)

(global-set-key (kbd "M-") 'my-increase-opacity)
(global-set-key (kbd "M-") 'my-decrease-opacity)