frame-defuns.el 685 B

123456789101112131415161718192021
  1. ;;; Code:
  2. ;; Frame-related defuns
  3. (defun distopico:opacity-modify (&optional dec)
  4. "Modify the transparency of the emacs frame; if DEC is t,
  5. decrease the transparency, otherwise increase it in 5% steps.
  6. Source: http://emacs-fu.blogspot.com/2009/02/transparent-emacs.html"
  7. (interactive "p")
  8. (let* ((alpha-or-nil (frame-parameter nil 'alpha)) ; nil before setting
  9. (oldalpha (if alpha-or-nil alpha-or-nil
  10. 100))
  11. (newalpha (if dec (- oldalpha 5)
  12. (+ oldalpha 5))))
  13. (when (and (>= newalpha frame-alpha-lower-limit)
  14. (<= newalpha 100))
  15. (modify-frame-parameters nil (list (cons 'alpha newalpha))))))
  16. (provide 'frame-defuns)
  17. ;;; end of frame-defuns.el