;;; bad-alpha.el --- interface to frame transparency -*- lexical-binding: t -*- ;; ;;; Commentary: ;; ;; This is an interface to the transparency parameter of an Emacs frame a.k.a. ;; a window in a window system, e.g. X11 if it doesn't work it is likely one ;; doesn't have a composition manager, for Linux/X, try 'picom --backend glx &' ;; in ~/.xinitrc. ;; ;; (bad-alpha 0.3) ; 30% ;; (bad-alpha) ; return ;; M-x bad-alpha RET ; echo ;; ;; (bad-alpha-inc 0.1) ; +10% ;; (bad-alpha-dec 0.1) ; decrease same ;; (bad-alpha-inc) ; default = 1.25% ;; (bad-alpha-dec) ; same ;; ;; (bad-alpha-7) a.k.a. (bad-alpha-full) ; 100% ;; (bad-alpha-6) ; 86% ;; (bad-alpha-5) a.k.a. (bad-alpha-huge) ; 71% ;; (bad-alpha-4) ; 57% ;; (bad-alpha-3) a.k.a. (bad-alpha-some) ; 42% ;; (bad-alpha-2) ; 29% ;; (bad-alpha-1) a.k.a. (bad-alpha-tiny) ; 14% ;; (bad-alpha-0) a.k.a. (bad-alpha-none) ; 0% ;; ;;; Code: (require 'cl-lib) (cl-pushnew "." load-path :test #'string=) (require 'luki-lisp) (defun bad-alpha (&optional alpha) (i) (if (and (! alpha) (! (called-interactively-p 'interactive))) (- 1 (frame-parameter nil 'alpha-background)) (when (n alpha) (setf alpha (min 1.0 (max 0.0 alpha))) (set-frame-parameter nil 'alpha-background (- 1 alpha))) ($ "alpha: %.0f%%" (* 100 (- 1 (frame-parameter nil 'alpha-background)))))) (defun bad-alpha-7 () (i) (bad-alpha 1 )) (defun bad-alpha-6 () (i) (bad-alpha .86 )) (defun bad-alpha-5 () (i) (bad-alpha .71 )) (defun bad-alpha-4 () (i) (bad-alpha .57 )) (defun bad-alpha-3 () (i) (bad-alpha .42 )) (defun bad-alpha-2 () (i) (bad-alpha .29 )) (defun bad-alpha-1 () (i) (bad-alpha .14 )) (defun bad-alpha-0 () (i) (bad-alpha 0 )) (defalias 'bad-alpha-full #'bad-alpha-7) (defalias 'bad-alpha-huge #'bad-alpha-5) (defalias 'bad-alpha-some #'bad-alpha-3) (defalias 'bad-alpha-tiny #'bad-alpha-1) (defalias 'bad-alpha-none #'bad-alpha-0) (defun bad-alpha-inc (&optional step) (i) (or step (setf step 0.125)) (bad-alpha (+ (bad-alpha) step))) (defun bad-alpha-dec (&optional step) (i) (or step (setf step 0.125)) (bad-alpha-inc (- step))) (<- 'bad-alpha) ;;; bad-alpha.el ends here