;; -*- lexical-binding: t; -*- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; excellent resources : https://gitlab.com/mark.feller/emacs.d/-/blob/master/modules/module-solarized.el ;; ;; https://protesilaos.com/codelog/2023-07-29-emacs-custom-modeline-tutorial/ ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; icon components for filename and git status (use-package all-the-icons :demand t :init (defun modeline-buffer-name () "Return 'buffer-name' with proper spacing and icon." (format " %s %s" (all-the-icons-icon-for-file (buffer-name)) (buffer-name))) (defvar-local bd/buffer-identification-mode-line '(:eval (format "%s" (modeline-buffer-name))) "Formats the modeline-buffer-name.") (defun git-vc-modeline () (let ((branch (mapconcat 'concat (cdr (split-string vc-mode "[:-]")) "-"))) (concat (propertize (format " %s" (all-the-icons-octicon "git-branch")) 'face `(:height 1 :family ,(all-the-icons-octicon-family)) 'display '(raise 0)) (propertize (format " %s" branch)) (propertize " ")))) (defvar-local bd/vc-mode-line '(:eval (when (and vc-mode (not (eq major-mode 'magit-status-mode))) ; temp fix to avoid bug which occurs in magit buffer (format "%s" (propertize (git-vc-modeline) 'face 'shadow)))) "Formats the checked out git repository.") (defvar-local bd/emms-mode-line '(:eval (when (and (mode-line-window-selected-p) emms-mode-line-string) (format "%s %s" emms-mode-line-string emms-playing-time-string))) "Formats the currently playing emms track.") :config (setq emms-mode-line-icon-before-format (format "%s" (all-the-icons-fileicon "owl")) emms-mode-line-icon-enabled-p t)) (use-package ednc :init (defun get-num-notifications () "Return number of active notifcations as a string." (format "%s" (length (ednc-notifications)))) (defvar-local bd/notify-mode-line '(:eval (when (and (ednc-notifications) (mode-line-window-selected-p)) (format " %s %s" (all-the-icons-material "notifications_active") (propertize (get-num-notifications) 'face 'error)))) "Formats the notification number.") (ednc-mode)) ;;;; time and date (setq display-time-format "%m/%d/%y %H:%M (%a)" display-time-default-load-average nil) (display-time) (defvar-local bd/time-mode-line '(:eval (when (mode-line-window-selected-p) display-time-string)) "displays current time and date in selected window.") (defun mode-line-fill (reserve) "Return empty space, leaving RESERVE space on the right." (unless reserve (setq reserve 20)) (when (and window-system (eq 'right (get-scroll-bar-mode))) (setq reserve (- reserve 3))) (propertize " " 'display `((space :align-to (- (+ right right-fringe right-margin) ,reserve))))) (dolist (construct '(bd/buffer-identification-mode-line bd/vc-mode-line bd/misc-mode-line)) (put construct 'risky-local-variable t)) (setq-default mode-line-format (list mode-line-front-space ;; mode-line-mule-info ;; mode-line-frame-identification bd/buffer-identification-mode-line " " mode-line-modes " " ;; mode-line-position mode-line-modified bd/notify-mode-line bd/vc-mode-line " " bd/emms-mode-line (mode-line-fill 21) bd/time-mode-line)) ;;;; remove mode-line-clutter (define-minor-mode minor-mode-blackout-mode "Hides minor modes from the mode line." t) (catch 'done (mapc (lambda (x) (when (and (consp x) (equal (cadr x) '("" minor-mode-alist))) (let ((original (copy-sequence x))) (setcar x 'minor-mode-blackout-mode) (setcdr x (list "" original))) (throw 'done t))) mode-line-modes)) (global-set-key (kbd "C-c m") 'minor-mode-blackout-mode) (defun disable_mode_line () (setq mode-line-format nil)) ;; custom function to remove mode line from images (add-hook 'image-mode-hook 'disable_mode_line) ;;;; true transparency ;; (add-to-list 'default-frame-alist '(alpha-background . 60)) (add-to-list 'default-frame-alist '(alpha . (85 . 85))) (defun set-frame-alpha (value) "Sets the transparency of the frame background. 0=transparent/100=opaque" (interactive "nTransparency Value 0 - 100 opaque:") (setq value (clamp 0 100 value)) (set-frame-parameter (selected-frame) 'alpha-background value) (message "Alpha set to %d" value)) ;;;; modus themes (defun modus-themes-custom-faces () (modus-themes-with-colors (custom-set-faces `(mode-line-inactive ((,class :background ,bg-main :foreground ,fg-active))) `(mode-line-active ((,class :background ,bg-main :foreground ,fg-active))) `(hl-line ((,class :background ,magenta-nuanced-bg))) `(emms-playlist-track-face ((,class :foreground ,blue-nuanced-fg))) `(emms-playlist-selected-face ((,class :foreground ,fg-special-cold))) `(emms-browser-track-face ((,class :foreground ,blue-nuanced-fg)))))) (add-hook 'modus-themes-after-load-theme-hook #'modus-themes-custom-faces) (setopt modus-themes-italic-constructs t modus-themes-bold-constructs t modus-themes-hl-line '(accented) modus-themes-subtle-line-numbers t modus-themes-paren-match '(intense) modus-themes-region '(bg-only) modus-themes-syntax '(faint) modus-themes-mode-line '(borderless) modus-themes-org-blocks 'gray-background modus-themes-headings '( (1 . (rainbow overline)))) (load-theme 'modus-vivendi t) (modus-themes-custom-faces)