Disable the default modeline and replace it by Noether

This commit is contained in:
Sameer Rahmani 2023-06-25 23:40:24 +01:00
parent 0c01ccf82b
commit b772ab634d
Signed by: lxsameer
GPG Key ID: B0A4AF28AB9FD90B
6 changed files with 187 additions and 35 deletions

View File

@ -299,6 +299,7 @@ https://emacsthemes.com/themes/badwolf-theme.html"
:title "Editor cube"
:no-flag t
(fg42/disable-modeline-cube)
(fpkg/use rainbow-delimiters
;; It doesn't work due to a problem/conflict in rainbow-delimiters
;; But we use it any way they might fix it
@ -357,11 +358,13 @@ https://emacsthemes.com/themes/badwolf-theme.html"
;; Call the editor related cubes. They will be run only if
;; their flag is active otherwise they will be skipped
(let ((mline (or (plist-get fg42/editor-cube-params :modeline)
#'fg42/default-modeline)))
;;(fg42/statusbar-cube)
(fg42/modeline-cube)
(fg42/setup-modeline-format mline)))
;;(fg42/modeline-cube)
;; (fg42/setup-modeline-format mline)
))
(provide 'cubes/editor)

View File

@ -53,6 +53,7 @@
(require 'cubes/proof)
(require 'cubes/agda)
(require 'cubes/notifications)
(require 'cubes/noether)
(defcube fg42/editor

View File

@ -29,17 +29,49 @@
"modeline/statusbar-default.el"
"The default StatusBar modeline.")
(defface fg42/-disabled-modeline-active-border
'((t
:background "#bd93f9" :height 0.1 :box nil))
"A new face for modeline in active state."
:group 'fg42)
(->cube smart-mode-line
(defface fg42/-disabled-modeline-dective-border
'((t
:background "#44475a" :height 0.1 :box nil))
"A new face for modeline in active state."
:group 'fg42)
(defcube fg42/disable-modeline-cube
"This cube disables the default modeline and replaces it with a thin border"
:title "Disable Mode line"
:flag disable-modeline
:flag-default nil
(setq-default mode-line-format "")
(let ((face-remaps (default-value 'face-remapping-alist)))
(setf (alist-get 'mode-line face-remaps)
'fg42/-disabled-modeline-active-border
(alist-get 'mode-line-inactive face-remaps)
'fg42/-disabled-modeline-dective-border
(default-value 'face-remapping-alist) face-remaps)))
(defcube fg42/smart-mode-line-cube
"Smart mode line is a pretty simple yet fantastic alternative
to Emacs modeline."
:straight (smart-mode-line :source melpa)
:defer nil
:init
(progn
(setq sml/theme 'respectful)
(setq sml/no-confirm-load-theme t)
(sml/setup)))
:title "Smart modeline cube"
:flag smart-mode-line
:flag-default nil
(fpkg/use smart-mode-line
:straight (smart-mode-line :source melpa)
:defer nil
:init
(progn
(setq sml/theme 'respectful)
(setq sml/no-confirm-load-theme t)
(sml/setup))))
;; TODO: Break this into two cubes
(defcube fg42/modeline-cube
@ -47,7 +79,7 @@ to Emacs modeline."
:title "Mini modeline"
:flag mini-mode-line
:group modeline
:flag-default t
:flag-default nil
(defun fg42/mini-modeline-setter (def)
(if (null def)
@ -67,30 +99,30 @@ to Emacs modeline."
mode-line-buffer-identification
mode-line-position
evil-mode-line-tag
(:eval (string-trim (format-mode-line mode-line-modes)))
;; (:eval (string-trim (format-mode-line mode-line-modes)))
mode-line-misc-info ))))
(fpkg/use mini-modeline
:straight (mini-modeline :repo "kiennq/emacs-mini-modeline"
:host github
:type git)
:after smart-mode-line
:init
(progn
(setq mini-modeline-enhance-visual nil)
(setq fg42/modeline-setter #'fg42/mini-modeline-setter))
:defer nil
:config
(add-hook 'fg42/after-init-hook #'mini-modeline-mode)
(add-hook 'fg42/after-initializing-theme-hook
(lambda ()
(custom-set-faces
'(mini-modeline-mode-line
((((background light))
:background "#aa0000" :height 0.1 :box nil)
(t
:background "#bd93f9" :height 0.1 :box nil))))))))
:straight (mini-modeline :repo "kiennq/emacs-mini-modeline"
:host github
:type git)
:after smart-mode-line
:init
(progn
(setq mini-modeline-enhance-visual nil)
(setq fg42/modeline-setter #'fg42/mini-modeline-setter))
:defer nil
:config
(add-hook 'fg42/after-init-hook #'mini-modeline-mode)
(add-hook 'fg42/after-initializing-theme-hook
(lambda ()
(custom-set-faces
'(mini-modeline-mode-line
((((background light))
:background "#aa0000" :height 0.1 :box nil)
(t
:background "#bd93f9" :height 0.1 :box nil))))))))
(defcube fg42/statusbar-cube

42
core/cubes/noether.el Normal file
View File

@ -0,0 +1,42 @@
;;; ModelineCubes --- The modeline related cubes for FG42 -*- lexical-binding: t; -*-
;;
;; Copyright (c) 2010-2023 Sameer Rahmani & Contributors
;;
;; Author: Sameer Rahmani <lxsameer@gnu.org>
;; URL: https://devheroes.codes/FG42/FG42
;; Version: 3.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:
(require 'fpkg)
(require 'fg42/cube)
(require 'cubes/icons)
(->cube noether-mode
"Smart mode line is a pretty simple yet fantastic alternative
to Emacs modeline."
:straight (noether-mode :repo "https://devheroes.codes/lxsameer/noether.git")
:init
(require 'noether)
(require 'noether-views)
(let ((views (or (plist-get fg42/noether-mode-cube-params :views) (list noether-minimal-mode-line))))
(setq noether-views views)
(noether-global-mode)))
(provide 'cubes/noether)
;;; noether.el ends here

73
core/fg42/status.el Normal file
View File

@ -0,0 +1,73 @@
;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
;;
;; Copyright (c) 2010-2023 Sameer Rahmani <lxsameer@gnu.org>
;;
;; Author: Sameer Rahmani <lxsameer@gnu.org>
;; URL: https://devheroes.codes/FG42/FG42
;; Version: 3.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:
;; Some of the functions in this module are borrowed from `mini-modeline'
;; at https://github.com/kiennq/emacs-mini-modeline (GPL). I modified to
;; fit my needs.
;;; Require
(require 'fpkg)
(fpkg/require 'all-the-icons)
(fpkg/require 'posframe)
(defvar fg42/status-buffer "*status-buffer*"
"The name of the status buffer to use.")
(defun fg42/status-show ()
(interactive)
(with-current-buffer fg42/status-buffer
(erase-buffer)
(insert (propertize (all-the-icons-octicon "package")
'face `(:family ,(all-the-icons-octicon-family) :height 1)
;; 'display '(raise -0.1)
) )
(insert "| A | B | C"))
(posframe-show
fg42/status-buffer
:min-height 1
:min-width 10
:position (cons (- (frame-outer-width) 10) (- (frame-outer-height) 10))
;;:poshandler #'posframe-poshandler-frame-bottom-right-corner
;;:border-width 1
:border-color "#aa00bb"
:accept-focus nil
:timeout 5
:refresh 1))
(posframe-delete-all)
(define-minor-mode fg42/global-statue-mode
"A minor mode that keep tracks of different status blocks.
It reports them back in a status bar like frame."
:global t
:lighter " ST42"
:keymap (let ((map (make-sparse-keymap)))))
(fg42/global-statue-mode)
(provide 'status.el)
;;; status.el ends here

View File

@ -52,11 +52,12 @@
`(use-package ,pkg :straight t :defer t)))
(defun fpkg/require (pkg)
(defmacro fpkg/require (pkg)
"Work like require but make sure that PKG is installed first."
(fpkg/use pkg
:init
(require pkg)))
(let ((pkg-name (intern (symbol-name `,(cadr pkg)))))
`(fpkg/use ,pkg-name
:init
(require ,pkg))))
(provide 'fpkg)
;;; fpkg.el ends here