about summary refs log tree commit diff
path: root/emacs.d/wpc/packages/wpc-ui.el
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2018-06-15T18·26-0400
committerWilliam Carroll <wpcarro@gmail.com>2018-07-19T16·00-0400
commitad496994c82b445c5f47956179f86ec5a7e26838 (patch)
tree34a8aaa978a095ebe70b3a6455ac894be2cf9f8e /emacs.d/wpc/packages/wpc-ui.el
parent27b1a74d074a6a0cbf1b7b7376b38127ee2471e9 (diff)
Support transparency toggling
The kbd, <super>-u, is modelled after iTerm's <super>-u kbd for toggling
transparency.
Diffstat (limited to 'emacs.d/wpc/packages/wpc-ui.el')
-rw-r--r--emacs.d/wpc/packages/wpc-ui.el14
1 files changed, 12 insertions, 2 deletions
diff --git a/emacs.d/wpc/packages/wpc-ui.el b/emacs.d/wpc/packages/wpc-ui.el
index c8126356e4f7..e4f0cd9f7ea5 100644
--- a/emacs.d/wpc/packages/wpc-ui.el
+++ b/emacs.d/wpc/packages/wpc-ui.el
@@ -57,8 +57,18 @@
 (setq initial-buffer-choice wpc/current-project)
 
 ;; transparent Emacs
-(set-frame-parameter (selected-frame) 'alpha '(100 . 100))
-(add-to-list 'default-frame-alist '(alpha . (100 . 100)))
+(set-frame-parameter (selected-frame) 'alpha '(90 . 90))
+(setq frame-transparent? t)
+
+(defun wpc/toggle-transparency ()
+  "Toggle the frame transparency."
+  (interactive)
+  (set-frame-parameter (selected-frame) 'alpha '(90 . 90))
+  (let ((alpha (if frame-transparent? 100 90)))
+    (set-frame-parameter (selected-frame) 'alpha `(,alpha . ,alpha)))
+  (setq frame-transparent? (not frame-transparent?)))
+
+(general-def "s-u" #'wpc/toggle-transparency)
 
 ;; premium Emacs themes
 (use-package doom-themes