From 7836d8aeb40c6b0a99a4b4ff89309b47c1345a4b Mon Sep 17 00:00:00 2001 From: yuzu-eva Date: Sat, 28 Oct 2023 15:30:24 +0200 Subject: feature: reworked the "toggle-transparancy" function --- config.org | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'config.org') diff --git a/config.org b/config.org index 5a0e250..10e1f0e 100644 --- a/config.org +++ b/config.org @@ -345,24 +345,21 @@ My preferred org-mode defaults * Custom functions -** Toggle transparency +** Set Frame Alpha -Something happened between emacs 28 and 29 that this needs to be toggled twice -for the first time. After that, it toggles as expected. Will try to fix this -when I find the time to do so. +Function to interactively set transparancy. #+begin_src emacs-lisp - (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))) - 100) - '(90 . 90) '(100 . 100))))) - - (global-set-key (kbd "C-c t") 'toggle-transparency) + (defun set-frame-alpha (arg &optional active) + (interactive "nEnter alpha value (1-100): \np") + (let* ((elt (assoc 'alpha default-frame-alist)) + (old (frame-parameter nil 'alpha)) + (new (cond ((atom old) `(,arg ,arg)) + ((eql 1 active) `(,arg ,(cadr old))) + (t `(,(car old) ,arg))))) + (if elt (setcdr elt new) (push `(alpha ,@new) default-frame-alist)) + (set-frame-parameter nil 'alpha new))) + (global-set-key (kbd "C-c t") 'set-frame-alpha) #+end_src ** Config edit/reload @@ -797,6 +794,12 @@ Autocompletion backend for C and C++ Some keybinds to make life easier +** Make do M-x + +#+begin_src emacs-lisp + (global-set-key (kbd "") 'execute-extended-command) +#+end_src + ** Open URL in browser #+begin_src emacs-lisp (global-set-key (kbd "C-c o") 'browse-url-at-point) -- cgit v1.2.3