diff options
-rw-r--r-- | init.org | 37 |
1 files changed, 19 insertions, 18 deletions
@@ -292,37 +292,38 @@ *** Transparency #+begin_src emacs-lisp (defvar jao-frames-default-alpha (if (eq window-system 'pgtk) 100 90)) - (defvar jao-transparent-p t) + (defvar jao-transparent-frame (< jao-frames-default-alpha 100)) + (defvar jao-transparent-only-bg nil) + + (defun jao-transparent-p () jao-transparent-frame) + + (defun jao-alpha-pair (&optional level) + (let ((level (or level jao-frames-default-alpha))) + (if (and (featurep 'gtk) jao-transparent-only-bg) + (cons 'alpha-background level) + (cons 'alpha (cons level level))))) (defun jao-sway-set-transparency (level) (when jao-sway-enabled-p (let ((alpha (/ level 100.0))) (jao-swaymsg (format "[app_id=emacs] opacity %s" alpha))))) - (defun jao-set-transparency (level) + (defun jao-set-transparency (level &optional all) (interactive "nOpacity (0-100): ") (let ((level (or level jao-frames-default-alpha))) (setq jao-transparent-p (< level 100)) (if jao-sway-enabled-p (jao-sway-set-transparency level) - (set-frame-parameter nil 'alpha (list level level))))) - - (defun jao-transparent-p () - (if jao-sway-enabled-p - jao-transparent-p - (/= (or (cadr (frame-parameter nil 'alpha)) 100) 100))) + (let ((a (jao-alpha-pair level))) + (if all + (modify-all-frames-parameters (list a)) + (set-frame-parameter nil (car a) (cdr a))))))) (defun jao-toggle-transparency (&optional all) (interactive "P") - (setq jao-transparent-p (not jao-transparent-p)) - (cond (jao-sway-enabled-p - (jao-sway-set-transparency (if jao-transparent-p 90 100))) - (all (let* ((trans (/= jao-frames-default-alpha 100)) - (new-alpha (if trans 100 jao-frames-default-alpha)) - (a `((alpha . (,new-alpha ,new-alpha))))) - (modify-all-frames-parameters a))) - ((jao-transparent-p) (jao-set-transparency 100)) - (t (jao-set-transparency jao-frames-default-alpha)))) + (let ((level (if jao-transparent-p 100 jao-frames-default-alpha))) + (jao-set-transparency level all))) + #+end_src *** Widgets #+begin_src emacs-lisp @@ -1174,7 +1175,7 @@ (vertical-scroll-bars . nil) (scroll-bar-width . 11) (menu-bar . nil) - (alpha . (,jao-frames-default-alpha ,jao-frames-default-alpha)) + ,(jao-alpha-pair) (font . ,jao-default-font))) #+end_src *** Frame layout, title, etc. |