parasurv's webspace

Emacs transparency

If you want to beautify your desktop and love some nice transparency effect, this is how you can do it, in Emacs.

This sets it for active and inactive frames, of course you can experiment with the values:

;;(set-frame-parameter (selected-frame) 'alpha '(<active> . <inactive>)) ;;(set-frame-parameter (selected-frame) 'alpha <both>) (set-frame-parameter (selected-frame) 'alpha '(85 . 50)) (add-to-list 'default-frame-alist '(alpha . (85 . 50)))

And here is a shortcut (C-c t) to turn it on/off:

(defun toggle-transparency () (interactive) (let ((alpha (frame-parameter nil 'alpha))) (set-frame-parameter nil 'alpha (if (eql (cond ((numberp alpha) alpha) ((numberp (cdr alpha)) (cdr alpha)) ;; Also handle undocumented (<active> <inactive>) form. ((numberp (cadr alpha)) (cadr alpha)))

'(85 . 50) '(100 . 100))))) (global-set-key (kbd "C-c t") 'toggle-transparency)

Credit: Emacs wiki

Hosted on Neocities, made with Emacs. Topics: Linux | Games | Culture | Tech