143 lines
4.3 KiB
EmacsLisp
143 lines
4.3 KiB
EmacsLisp
;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
|
|
;;
|
|
;; Copyright (c) 2010-2024 Sameer Rahmani <lxsameer@gnu.org>
|
|
;;
|
|
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
|
;; URL: https://devheroes.codes/FG42/FG42
|
|
;; Version: 4.0.0
|
|
;;
|
|
;; This program is free software; you can redistribute it and/or modify
|
|
;; it under the terms of the GNU General Public License as published by
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
;; (at your option) any later version.
|
|
;;
|
|
;; This program is distributed in the hope that it will be useful,
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
;; GNU General Public License for more details.
|
|
;;
|
|
;; You should have received a copy of the GNU General Public License
|
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
;;
|
|
;;; Commentary:
|
|
;;; Code:
|
|
(eval-when-compile
|
|
(require 'fpkg))
|
|
|
|
(require 'fg42/utils)
|
|
|
|
(defvar fg42/modeline-views nil
|
|
"A list of Noether views to use for modeline.")
|
|
|
|
|
|
(defvar fg42/modeline-active-face nil
|
|
"Override the active modeline face via this var.")
|
|
|
|
(defvar fg42/modeline-inactive-face nil
|
|
"Override the inactive modeline face via this var.")
|
|
|
|
(defface fg42/-disabled-modeline-active-border
|
|
'((t
|
|
:background "#bd93f9" :height 0.1 :box nil))
|
|
"A new face for modeline in active state."
|
|
:group 'fg42)
|
|
|
|
|
|
(defface fg42/-disabled-modeline-dective-border
|
|
'((t
|
|
:background "#44475a" :height 0.1 :box nil))
|
|
"A new face for modeline in active state."
|
|
:group 'fg42)
|
|
|
|
|
|
(use! noether
|
|
"Smart mode line is a pretty simple yet fantastic alternative
|
|
to Emacs modeline."
|
|
:if (display-graphic-p)
|
|
:after projectile
|
|
:commands noether-global-mode
|
|
|
|
:config
|
|
(require 'noether-views)
|
|
|
|
(let ((active-border (get-base16-color-or :base0A "#bd93f9"))
|
|
(inactive-border (get-base16-color-or :base03 "#44475a")))
|
|
(set-face-attribute 'fg42/-disabled-modeline-active-border nil :background active-border)
|
|
(set-face-attribute 'fg42/-disabled-modeline-dective-border nil :background inactive-border))
|
|
|
|
;; Disable the default modeline
|
|
(setq-default mode-line-format "")
|
|
(let ((face-remaps (default-value 'face-remapping-alist)))
|
|
(setf (alist-get 'mode-line face-remaps)
|
|
(if fg42/modeline-active-face fg42/modeline-active-face 'fg42/-disabled-modeline-active-border)
|
|
(alist-get 'mode-line-inactive face-remaps)
|
|
(if fg42/modeline-inactive-face fg42/modeline-inactive-face 'fg42/-disabled-modeline-dective-border)
|
|
(default-value 'face-remapping-alist) face-remaps))
|
|
|
|
(when-not-wm
|
|
(require 'noether-units)
|
|
(require 'nerd-icons)
|
|
(require 'projectile)
|
|
|
|
(defvar noether--mode-icon)
|
|
|
|
(defun noether--update-mode-icon ()
|
|
"Set the current buffer name to the watched var."
|
|
(setq noether--mode-icon major-mode))
|
|
|
|
|
|
(defun noether--format-mode-icon (_ v _ _)
|
|
"Format the icon V."
|
|
(nerd-icons-icon-for-mode v))
|
|
|
|
|
|
(noether-defunit mode-icon
|
|
"Draws an icon for the current major mode."
|
|
:label ""
|
|
:len 1
|
|
:init (lambda ()
|
|
(add-hook 'post-command-hook #'noether--update-mode-icon))
|
|
|
|
:deinit (lambda ()
|
|
(remove-hook 'post-command-hook #'noether--update-mode-icon))
|
|
|
|
:var 'noether--mode-icon
|
|
:fn #'noether--format-mode-icon)
|
|
|
|
|
|
(noether-defview fg42-modeline
|
|
"A simple and minimalist mode-line like status bar"
|
|
:managed? t
|
|
:binding (kbd "C-c 0")
|
|
:buffer "*modeline"
|
|
:visible? t
|
|
:timeout 0
|
|
|
|
:frame
|
|
(list
|
|
:position
|
|
(cons (- (frame-inner-width) 690)
|
|
(- (frame-outer-height) 20))
|
|
:border-width 0
|
|
:border-color "#bd93f9")
|
|
|
|
:units
|
|
(list
|
|
(buffer-name-unit :label (format "%s " (nerd-icons-codicon "nf-cod-layers"))
|
|
:len 20)
|
|
;; (mode-name-unit :label " " :len 4)
|
|
(projectile-project-unit :label (format "%s " (nerd-icons-octicon "nf-oct-project"))
|
|
:len 20)
|
|
(git-branch-unit :label (format "%s " (nerd-icons-devicon "nf-dev-git_branch"))
|
|
:len 20)
|
|
(mode-icon)
|
|
(line-unit :label "")))
|
|
|
|
(setq-default noether-views (list fg42-modeline)))
|
|
|
|
(when-wm
|
|
(setq-default noether-views (list noether-minimal-exwm))))
|
|
|
|
(provide 'fg42/modeline)
|
|
;;; modeline.el ends here
|