The following code for your .emacs makes it easy to set transparency from within emacs:
(defun djcb-opacity-modify (&optional dec)
"modify the transparency of the emacs frame; if DEC is t,
decrease the transparency, otherwise increase it in 10%-steps"
(let* ((alpha-or-nil (frame-parameter nil 'alpha)) ; nil before setting
(oldalpha (if alpha-or-nil alpha-or-nil 100))
(newalpha (if dec (- oldalpha 10) (+ oldalpha 10))))
(when (and (>= newalpha frame-alpha-lower-limit) (<= newalpha 100))
(modify-frame-parameters nil (list (cons 'alpha newalpha))))))
;; C-8 will increase opacity (== decrease transparency)
;; C-9 will decrease opacity (== increase transparency
;; C-0 will returns the state to normal
(global-set-key (kbd "C-8") '(lambda()(interactive)(djcb-opacity-modify)))
(global-set-key (kbd "C-9") '(lambda()(interactive)(djcb-opacity-modify t)))
(global-set-key (kbd "C-0") '(lambda()(interactive)
(modify-frame-parameters nil `((alpha . 100)))))
Now, you can make make emacs more transparent (less opaque) by pressing C-9, while C-8 has the opposite effect. C-0 brings us back to normality.
Admittedly, window transparency is a classical solution-looking-for-a-problem. But let that not stop us from using it -- now we can watch full-screen movies while still using emacs. That, my friends, is progress.
No comments:
Post a Comment