mirror of
https://github.com/jimeh/.emacs.d.git
synced 2026-02-19 13:46:41 +00:00
I've set `lexical-binding` to `nil` in all Emacs Lisp files to suppress the warnings introduced in Emacs 31 requiring all elisp files to have a `lexical-binding` comment. This retains the default behavior of dynamic binding when no `lexical-binding` comment is present. With it set to `t` across the board, various things break, and fixing those is a task for another day.
58 lines
1.9 KiB
EmacsLisp
58 lines
1.9 KiB
EmacsLisp
;;; siren-transparency.el --- jimeh's Emacs Siren: Emacs Frame transparency. -*- lexical-binding: nil; -*-
|
|
|
|
;;; Commentary:
|
|
|
|
;; Basic helpers and configuration for frame transparency.
|
|
|
|
;;; Code:
|
|
|
|
(require 'siren-ui)
|
|
|
|
(defgroup siren-transparency nil
|
|
"Options for the Siren transparency."
|
|
:group 'siren-ui)
|
|
|
|
(defcustom siren-transparency-default-level 99
|
|
"The default frame transparency level for Emacs frames."
|
|
:type 'number
|
|
:set (lambda (symbol value)
|
|
(set-default symbol value)
|
|
(setf (alist-get 'alpha default-frame-alist) value))
|
|
:group 'siren)
|
|
|
|
(defun siren-transparency-decrease ()
|
|
"Decrease level of transparency for the current frame."
|
|
(interactive)
|
|
(let ((current (or (frame-parameter nil 'alpha) 100)))
|
|
(if (> current 0)
|
|
(let ((new-level (+ current -1)))
|
|
(siren-transparency new-level)
|
|
(message "Frame transparency set to %s" new-level))
|
|
(message "This is a minimum value of transparency!"))))
|
|
|
|
(defun siren-transparency-increase ()
|
|
"Increase level of transparency for the current frame."
|
|
(interactive)
|
|
(let ((current (or (frame-parameter nil 'alpha) 100)))
|
|
(if (< current 100)
|
|
(let ((new-level (+ current +1)))
|
|
(siren-transparency new-level)
|
|
(message "Frame transparency set to %s" new-level))
|
|
(message "This is a minimum value of transparency!"))))
|
|
|
|
(defun siren-transparency (num)
|
|
"Set level of transparency for the current frame by providing NUM."
|
|
(interactive "nEnter transparency level in range 0-100: ")
|
|
(set-frame-parameter nil 'alpha (cond ((> num 100) 100)
|
|
((< num 0) 0)
|
|
(t num))))
|
|
|
|
;; Keybindings
|
|
(siren-general-define-key
|
|
"C-M-|" 'siren-transparency
|
|
"C-M-<" 'siren-transparency-decrease
|
|
"C-M->" 'siren-transparency-increase)
|
|
|
|
(provide 'siren-transparency)
|
|
;;; siren-transparency.el ends here
|