Compare commits

...

4 Commits

15 changed files with 524 additions and 143 deletions

View File

@ -25,6 +25,9 @@ let
./editor ./editor
./elisp ./elisp
./git ./git
./minibuffer-vertico
./graphics
./noether
]; ];
pkgsModule = { config, ... }: { pkgsModule = { config, ... }: {

View File

@ -41,23 +41,11 @@ let
yasnippet yasnippet
yasnippet-snippets yasnippet-snippets
flycheck flycheck
vertico
orderless
ctrlf
consult
marginalia
svg-tag-mode
all-the-icons
org org
org-super-agenda org-super-agenda
org-ql org-ql
org-modern org-modern
base16-theme base16-theme
] ++ lib.optionals (config.fg42.emojify) [
emojify
] ++ lib.optionals (config.fg42.modeline == "noether") [
posframe
extraPackages.noether
]); ]);
drv = makeFG42Drv { drv = makeFG42Drv {
@ -68,27 +56,15 @@ let
}; };
dicts = pkgs.aspellWithDicts (dicts: with dicts; [ en en-computers en-science ]); dicts = pkgs.aspellWithDicts (dicts: with dicts; [ en en-computers en-science ]);
emojifyDocString = "Whether or not to use the `emojify' package.";
in in
{ {
options = (with lib; {
fg42.emojify = mkOption
{
type = types.bool;
default = false;
description = emojifyDocString;
};
});
config = { config = {
fg42.elispPackages = [ drv ] ++ deps; fg42.elispPackages = [ drv ] ++ deps;
fg42.fonts = (with pkgs;[ fg42.fonts = (with pkgs;[
vazir-fonts vazir-fonts
fira-code
fira-mono fira-mono
noto-fonts
]); ]);
fg42.paths = (with pkgs;[ fg42.paths = (with pkgs;[
@ -96,10 +72,10 @@ in
dicts dicts
]); ]);
fg42.font = lib.mkDefault '''("Fira Mono" 11)''; fg42.font = {
name = lib.mkDefault "Fira Mono";
size = 11;
};
fg42.requires = [ drv.pname ]; fg42.requires = [ drv.pname ];
fg42.vars = [
(lib.defVar "emojify" cfg.emojify emojifyDocString)
];
}; };
} }

View File

@ -36,21 +36,17 @@
;; (require 'fg42/langs/elisp) ;; (require 'fg42/langs/elisp)
;; (require 'fg42/langs/nix) ;; (require 'fg42/langs/nix)
;;(require 'fg42/git)
;; (require 'fg42/wm) ;; (require 'fg42/wm)
(require 'fg42/organize) (require 'fg42/organize))
;;(require 'fg42/minibuffer)
;;(require 'fg42/graphics)
;;(require 'fg42/modeline)
)
(require 'server) (require 'server)
(require 'fg42/utils) (require 'fg42/utils)
(defun fg42/setup-font () (defun fg42/setup-font ()
"Set the default font of `FG42' to FONT-NAME and FONT-SIZE." "Set the default font of `FG42' to FONT-NAME and FONT-SIZE."
(let ((name (car fg42/font)) (let ((name (fg42/config-get font-name))
(size (cadr fg42/font))) (size (fg42/config-get font-size)))
(add-to-list 'default-frame-alist (add-to-list 'default-frame-alist
(cons 'font (format "%s-%d" name size))) (cons 'font (format "%s-%d" name size)))
@ -206,7 +202,7 @@ contextual information."
;; In the following section we're setting some default behavior of FG42. ;; In the following section we're setting some default behavior of FG42.
;; Most of these configuration are opiniated and I think most of people ;; Most of these configuration are opiniated and I think most of people
;; shared the same opinion or don't care at all. ;; shared the same opinion or don't care at all.
;;(fg42/setup-font) (fg42/setup-font)
(add-hook 'fg42/after-init-hook (add-hook 'fg42/after-init-hook
(lambda () (lambda ()
(set-default 'cursor-type 'bar) (set-default 'cursor-type 'bar)

View File

@ -1,38 +0,0 @@
;;; 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/config))
(require 'fg42/utils)
(if (string= (fg42/config-get-or modeline "") "noether")
(require 'fg42/modeline-noether)
(progn
;; TODO: Setup the normal mode line
))
(provide 'fg42/modeline)
;;; modeline.el ends here

View File

@ -22,7 +22,7 @@
{ lib, config, pkgs, makeFG42Drv, ... }: { lib, config, pkgs, makeFG42Drv, ... }:
with lib; with lib;
let let
cfg = config.fg42.features.git; cfg = config.fg42.git;
deps = deps =
(with pkgs.emacsPackages; [ (with pkgs.emacsPackages; [
@ -39,7 +39,7 @@ let
}; };
in in
{ {
options.fg42.features.git.enable = mkAndEnableOption "git"; options.fg42.git.enable = mkAndEnableOption "git";
config = mkIf cfg.enable { config = mkIf cfg.enable {
fg42.elispPackages = [ drv ] ++ deps; fg42.elispPackages = [ drv ] ++ deps;

View File

@ -0,0 +1,69 @@
# Fg42 - Emacs Editor for advance users
#
# Copyright (c) 2010-2024 Sameer Rahmani <lxsameer@gnu.org>
#
# 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, version 2.
#
# 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/>.
# This is the home manager module that exposes FG42. It differs
# from FG42 modules that are structurally the same but used in
# different context
# A list of default FG42 modules to build FG42 with.
{ lib, config, pkgs, makeFG42Drv, ... }:
with lib;
let
cfg = config.fg42.graphics;
deps =
(with pkgs.emacsPackages; [
svg-tag-mode
nerd-icons
nerd-icons-completion
] ++ lib.optionals (cfg.emojify) [
emojify
]);
drv = makeFG42Drv {
pname = "graphics";
version = config.fg42.version;
buildInputs = deps;
src = ./.;
};
emojifyDocString = "Whether or not to use the `emojify' package.";
in
{
options = (with lib; {
fg42.graphics.enable = mkAndEnableOption "graphics";
fg42.graphics.emojify = mkOption
{
type = types.bool;
default = false;
description = emojifyDocString;
};
});
config = mkIf cfg.enable {
fg42.elispPackages = [ drv ] ++ deps;
fg42.fonts =
(with pkgs;[
(nerdfonts.override { fonts = [ "NerdFontsSymbolsOnly" ]; })
]);
fg42.requires = [ drv.pname ];
fg42.vars = [
(lib.defVar "graphics" cfg.enable "Graphics/icons support for FG42")
(lib.defVar "emojify" cfg.emojify emojifyDocString)
];
};
}

View File

@ -31,7 +31,8 @@
:if (display-graphic-p) :if (display-graphic-p)
:hook (emacs-startup . global-emojify-mode)) :hook (emacs-startup . global-emojify-mode))
(use! all-the-icons
(use! nerd-icons
"A utility package to collect various Icon Fonts and propertize them within "A utility package to collect various Icon Fonts and propertize them within
Emacs." Emacs."
:if (display-graphic-p)) :if (display-graphic-p))

View File

@ -0,0 +1,51 @@
# Fg42 - Emacs Editor for advance users
#
# Copyright (c) 2010-2024 Sameer Rahmani <lxsameer@gnu.org>
#
# 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, version 2.
#
# 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/>.
# This is the home manager module that exposes FG42. It differs
# from FG42 modules that are structurally the same but used in
# different context
# A list of default FG42 modules to build FG42 with.
{ lib, config, pkgs, makeFG42Drv, ... }:
with lib;
let
cfg = config.fg42.minibuffer.vertico;
deps =
(with pkgs.emacsPackages; [
vertico
orderless
ctrlf
consult
marginalia
]);
drv = makeFG42Drv {
pname = "minibuffer-vertico";
version = config.fg42.version;
buildInputs = deps;
src = ./.;
};
in
{
options.fg42.minibuffer.vertico.enable = mkAndEnableOption "vertico";
config = mkIf cfg.enable {
fg42.elispPackages = [ drv ] ++ deps;
fg42.requires = [ drv.pname ];
};
}

View File

@ -0,0 +1,217 @@
;;; 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/config))
(use! vertico
"Vertico provides a performant and minimalistic vertical completion UI
based on the default completion system. The focus of Vertico is to provide
a UI which behaves correctly under all circumstances."
:config
(require 'vertico-multiform)
(require 'vertico-flat)
(require 'vertico-grid)
(require 'vertico-buffer)
(require 'vertico-indexed)
(require 'vertico-quick)
(require 'vertico-repeat)
(vertico-mode)
(vertico-multiform-mode)
;; Configure the display per command.
;; Use a buffer with indices for imenu
(setq vertico-multiform-commands
'((imenu buffer indexed)))
;; Configure the display per completion category.
;; Use the grid display for files and a buffer
;; for the consult-grep commands.
(setq vertico-multiform-categories
'((file grid)))
(setq vertico-count 10)
(setq vertico-cycle t)
(when-wm
(setq vertico-multiform-commands
'((t flat)))
(setq vertico-multiform-categories
'((file flat)))))
(use! orderless
"This package provides an orderless completion style that divides the
pattern into space-separated components, and matches candidates that
match all of the components in any order."
:init
(setq completion-styles '(orderless basic)
completion-category-defaults nil
completion-category-overrides '((file (styles partial-completion)))))
(use! marginalia
"Adds useful info to minibuffers completions."
:commands marginalia-mode
:hook (emacs-startup . marginalia-mode))
(when-not-wm
(use! ctrlf
"Single buffer text search."
:config
(ctrlf-mode +1)))
(use! consult
"Consult provides search and navigation commands based on the Emacs completion
function completing-read. "
;; C-c bindings in `mode-specific-map'
:bind (("C-c M-x" . consult-mode-command)
("C-c h" . consult-history)
("C-c k" . consult-kmacro)
("C-c m" . consult-man)
("C-c i" . consult-info)
([remap Info-search] . consult-info)
;; C-x bindings in `ctl-x-map'
("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command
("C-x b" . consult-buffer) ;; orig. switch-to-buffer
("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame
("C-x t b" . consult-buffer-other-tab) ;; orig. switch-to-buffer-other-tab
("C-x r b" . consult-bookmark) ;; orig. bookmark-jump
("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer
;; Custom M-# bindings for fast register access
("M-#" . consult-register-load)
("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated)
("C-M-#" . consult-register)
;; Other custom bindings
("M-y" . consult-yank-pop) ;; orig. yank-pop
;; M-g bindings in `goto-map'
("M-g f" . consult-flymake) ;; Alternative: consult-flycheck
("M-g g" . consult-goto-line)
("M-g M-g" . consult-goto-line)
("M-g o" . consult-outline) ;; Alternative: consult-org-heading
("M-g m" . consult-mark)
("M-g k" . consult-global-mark)
;; M-s bindings in `search-map'
("M-s d" . consult-fd)
("M-s c" . consult-locate)
("M-s g" . consult-grep)
("M-s G" . consult-git-grep)
("M-s r" . consult-ripgrep)
("M-s l" . consult-line)
("M-s L" . consult-line-multi)
("M-s k" . consult-keep-lines)
("M-s u" . consult-focus-lines)
;; Isearch integration
("M-s e" . consult-isearch-history)
:map isearch-mode-map
("M-e" . consult-isearch-history) ;; orig. isearch-edit-string
("M-s e" . consult-isearch-history) ;; orig. isearch-edit-string
("M-s l" . consult-line) ;; needed by consult-line to detect isearch
("M-s L" . consult-line-multi) ;; needed by consult-line to detect isearch
;; Minibuffer history
:map minibuffer-local-map
("M-s" . consult-history) ;; orig. next-matching-history-element
("M-r" . consult-history)) ;; orig. previous-matching-history-element
;; Enable automatic preview at point in the *Completions* buffer. This is
;; relevant when you use the default completion UI.
:hook (completion-list-mode . consult-preview-at-point-mode)
:init
;; Configure the register formatting. This improves the register
;; preview for `consult-register', `consult-register-load',
;; `consult-register-store' and the Emacs built-ins.
(setq register-preview-delay 0.5
register-preview-function #'consult-register-format)
;; Tweak the register preview window.
;; This adds thin lines, sorting and hides the mode line of the window.
(advice-add #'register-preview :override #'consult-register-window)
:config
(when-wm
(consult-customize
;; Set preview for `consult-buffer' to key `M-.'
consult-buffer :preview-key nil))
;; For some reason `consult's autoloads do not work
(require 'consult-xref)
;; Use Consult to select xref locations with preview
(setq xref-show-xrefs-function #'consult-xref
xref-show-definitions-function #'consult-xref)
;; Configure preview. The default value
;; is 'any, such that any key triggers the preview.
;; (setq consult-preview-key 'any)
;; (setq consult-preview-key "M-.")
;; (setq consult-preview-key '("S-<down>" "S-<up>"))
;; For some commands and buffer sources it is useful to configure the
;; :preview-key on a per-command basis using the `consult-customize' macro.
(consult-customize
consult-theme :preview-key '(:debounce 0.2 any)
consult-ripgrep consult-git-grep consult-grep
consult-bookmark consult-recent-file consult-xref
consult--source-bookmark consult--source-file-register
consult--source-recent-file consult--source-project-recent-file
;; :preview-key "M-."
:preview-key '(:debounce 0.4 any))
;; Configure the narrowing key.
;; Both < and C-+ work reasonably well.
(setq consult-narrow-key "<") ;; "C-+"
(autoload 'projectile-project-root "projectile")
(setq consult-project-function (lambda (_) (projectile-project-root)))
;; Optionally make narrowing help available in the minibuffer.
;; You may want to use `embark-prefix-help-command' or which-key instead.
;; (define-key consult-narrow-map (vconcat consult-narrow-key "?") #'consult-narrow-help)
)
;; For some reason `consult's autoloads do not work
(use! consult-imenu
"Setup the `consult-imenu' stuff."
:after consult
:bind (("M-i" . consult-imenu)
("M-I" . consult-imenu-multi)))
(use! consult-compile
"Setup the `consult-compile' stuff."
:after consult
:bind (("M-g e" . consult-compile-error)))
(with-config "graphics"
(use! nerd-icons-completion
"Nerd icons in marginalia"
:after marginalia
:config
(nerd-icons-completion-mode)
(add-hook 'marginalia-mode-hook #'nerd-icons-completion-marginalia-setup)))
(provide 'fg42/minibuffer-vertico)
;;; minibuffer-vertico.el ends here

View File

@ -0,0 +1,57 @@
# Fg42 - Emacs Editor for advance users
#
# Copyright (c) 2010-2024 Sameer Rahmani <lxsameer@gnu.org>
#
# 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, version 2.
#
# 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/>.
# This is the home manager module that exposes FG42. It differs
# from FG42 modules that are structurally the same but used in
# different context
# A list of default FG42 modules to build FG42 with.
{ lib, config, pkgs, makeFG42Drv, extraPackages, ... }:
with lib;
let
cfg = config.fg42.noether;
deps =
(with pkgs.emacsPackages; [
posframe
extraPackages.noether
]);
drv = makeFG42Drv {
pname = "noether";
version = config.fg42.version;
buildInputs = deps;
src = ./.;
};
in
{
imports = [
../graphics
];
options.fg42.noether.enable = mkAndEnableOption "noether";
options.fg42.noether.modeline.enable = mkAndEnableOption "noether-modeline";
config = mkIf cfg.enable {
fg42.elispPackages = [ drv ] ++ deps;
fg42.requires = [ drv.pname ];
fg42.vars = [
(lib.defVar "noether" cfg.enable "Whether or not enable Noether mode.")
(lib.defVar "noether-modeline" cfg.modeline.enable "Whether or not enable Noether's modeline.")
];
};
}

View File

@ -22,38 +22,39 @@
;;; Commentary: ;;; Commentary:
;;; Code: ;;; Code:
(eval-when-compile (eval-when-compile
(require 'fpkg)) (require 'fpkg)
(require 'fg42/config))
(require 'noether) (require 'noether)
(require 'noether-units) (require 'noether-units)
(require 'projectile) (require 'projectile)
(require 'nerd-icons)
(with-config "graphics"
(require 'nerd-icons)
(defvar fg42/-mode-icon)
(defun fg42/-update-mode-icon ()
"Set the current buffer name to the watched var."
(setq fg42/-mode-icon major-mode))
(defun fg42/-format-mode-icon (_ v _ _)
"Format the icon V."
(format " %s " (nerd-icons-icon-for-mode v)))
(defvar fg42/-mode-icon) (noether-defunit fg42/mode-icon
"Draws an icon for the current major mode."
:label ""
:len 3
:init (lambda ()
(add-hook 'post-command-hook #'fg42/-update-mode-icon))
(defun fg42/-update-mode-icon () :deinit (lambda ()
"Set the current buffer name to the watched var." (remove-hook 'post-command-hook #'fg42/-update-mode-icon))
(setq fg42/-mode-icon major-mode))
:var 'fg42/-mode-icon
(defun fg42/-format-mode-icon (_ v _ _) :fn #'fg42/-format-mode-icon))
"Format the icon V."
(format " %s " (nerd-icons-icon-for-mode v)))
(noether-defunit fg42/mode-icon
"Draws an icon for the current major mode."
:label ""
:len 3
:init (lambda ()
(add-hook 'post-command-hook #'fg42/-update-mode-icon))
:deinit (lambda ()
(remove-hook 'post-command-hook #'fg42/-update-mode-icon))
:var 'fg42/-mode-icon
:fn #'fg42/-format-mode-icon)
;; ============================================================================ ;; ============================================================================
;; Exwm input mode ;; Exwm input mode

View File

@ -22,18 +22,20 @@
;;; Commentary: ;;; Commentary:
;;; Code: ;;; Code:
(eval-when-compile (eval-when-compile
(require 'fpkg)) (require 'fpkg)
(require 'fg42/config))
(require 'fg42/modeline/units) (require 'fg42/modeline/units)
(defun fg42/--bottom-right (info) (defun fg42/--bottom-right (info)
"Keep the modeline at bottom right by using the data from INFO." "Keep the modeline at bottom right by using the data from INFO."
(cons -1 -1)) (cons -1 -2))
(defun fg42/--bottom-right-padded (info) (defun fg42/--bottom-right-padded (info)
"Keep the modeline at bottom right by using the data from INFO." "Keep the modeline at bottom right by using the data from INFO."
(cons -70 -1)) (cons -70 -2))
(defun fg42/adjust-modeline (view) (defun fg42/adjust-modeline (view)
@ -54,23 +56,41 @@
:right-fringe 5 :right-fringe 5
:poshandler #'fg42/--bottom-right :poshandler #'fg42/--bottom-right
:border-width 0 :border-width 0
:font (format "%s %s" (car fg42/font) (- (cadr fg42/font) 1)) :font (format "%s %s" (fg42/config-get font-name) (- (fg42/config-get font-size) 1))
:border-color "#bd93f9") :border-color "#bd93f9")
:units :units
(list (if-config "graphics"
(buffer-name-unit ;; Then
:label (format "%s " (nerd-icons-codicon "nf-cod-layers")) (progn
:len 20) (require 'nerd-icons)
(projectile-project-unit (list
:label (format "%s " (nerd-icons-octicon "nf-oct-project")) (buffer-name-unit
:len 20) :label (format "%s " (nerd-icons-codicon "nf-cod-layers"))
(git-branch-unit :len 20)
:label (format "%s " (nerd-icons-devicon "nf-dev-git_branch")) (projectile-project-unit
:len 20) :label (format "%s " (nerd-icons-octicon "nf-oct-project"))
(fg42/mode-icon) :len 20)
(line-unit :label (format "%s " (nerd-icons-codicon "nf-cod-location"))) (git-branch-unit
(time-unit :label (format " %s " (nerd-icons-mdicon "nf-md-clock_time_three"))))) :label (format "%s " (nerd-icons-devicon "nf-dev-git_branch"))
:len 20)
(fg42/mode-icon)
(line-unit :label (format "%s " (nerd-icons-codicon "nf-cod-location")))
(time-unit :label (format " %s " (nerd-icons-mdicon "nf-md-clock_time_three")))))
;; Else
(progn
(list
(buffer-name-unit
:label "B: "
:len 20)
(projectile-project-unit
:label "P: "
:len 20)
(git-branch-unit
:label "G: "
:len 20)
(line-unit :label "L: ")
(time-unit :label "T: ")))))
(noether-defview fg42/minimal-exwm (noether-defview fg42/minimal-exwm

View File

@ -22,11 +22,11 @@
;;; Commentary: ;;; Commentary:
;;; Code: ;;; Code:
(eval-when-compile (eval-when-compile
(require 'fpkg)) (require 'fpkg)
(require 'fg42/config)
(require 'fg42/utils))
(require 'fg42/utils) (defvar fg42/noether-views nil
(defvar fg42/modeline-views nil
"A list of Noether views to use for modeline.") "A list of Noether views to use for modeline.")
(defvar fg42/modeline-active-face nil (defvar fg42/modeline-active-face nil
@ -60,26 +60,30 @@ to Emacs modeline."
(require 'noether-views) (require 'noether-views)
(require 'fg42/modeline/views) (require 'fg42/modeline/views)
(let ((active-border (get-base16-color-or :base0A "#bd93f9")) (with-config "noether-modeline"
(inactive-border (get-base16-color-or :base03 "#44475a"))) (let ((active-border (get-base16-color-or :base0A "#bd93f9"))
(set-face-attribute 'fg42/-disabled-modeline-active-border nil :background active-border) (inactive-border (get-base16-color-or :base03 "#44475a")))
(set-face-attribute 'fg42/-disabled-modeline-dective-border nil :background inactive-border)) (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 ;; Disable the default modeline
(setq-default mode-line-format "") (setq-default mode-line-format "")
(let ((face-remaps (default-value 'face-remapping-alist))) (let ((face-remaps (default-value 'face-remapping-alist)))
(setf (alist-get 'mode-line face-remaps) (setf (alist-get 'mode-line face-remaps)
(if fg42/modeline-active-face fg42/modeline-active-face 'fg42/-disabled-modeline-active-border) (if fg42/modeline-active-face fg42/modeline-active-face 'fg42/-disabled-modeline-active-border)
(alist-get 'mode-line-inactive face-remaps) (alist-get 'mode-line-inactive face-remaps)
(if fg42/modeline-inactive-face fg42/modeline-inactive-face 'fg42/-disabled-modeline-dective-border) (if fg42/modeline-inactive-face fg42/modeline-inactive-face 'fg42/-disabled-modeline-dective-border)
(default-value 'face-remapping-alist) face-remaps)) (default-value 'face-remapping-alist) face-remaps))
(add-to-list 'fg42/noether-views fg42/modeline))
;; Setup modelines ;; Setup modelines
(when-not-wm (when-not-wm
(setq-default noether-views (list fg42/modeline))) (setq-default noether-views fg42/noether-views))
(when-wm (when-wm
(setq-default noether-views nil))) (setq-default noether-views nil)))
(provide 'fg42/modeline-noether) (provide 'fg42/noether)
;;; modeline-noether.el ends here ;;; noether.el ends here

View File

@ -44,6 +44,7 @@ in
type = types.package; type = types.package;
default = pkgs.emacs29.override ({ default = pkgs.emacs29.override ({
withTreeSitter = true; withTreeSitter = true;
toolkit = "no";
}); });
description = "What Emacs package to use."; description = "What Emacs package to use.";
}; };
@ -82,8 +83,18 @@ in
}; };
fg42.font = mkOption { fg42.font = mkOption {
type = types.uniq types.str; type = types.submodule {
example = "fg42.font = ''(cons \"Fira Code\" 10) '';"; options = {
name = mkOption {
type = types.str;
};
size = mkOption {
type = types.int;
};
};
};
example = ''fg42.font = {name = "Fira Mono"; size = 10; };'';
description = "The default font for FG42"; description = "The default font for FG42";
}; };
@ -171,8 +182,11 @@ in
fg42.elispPackages = [ drv ]; fg42.elispPackages = [ drv ];
fg42.theme = lib.mkDefault "base16-eighties"; fg42.theme = lib.mkDefault "base16-eighties";
fg42.theme-package-name = lib.mkDefault "base16-theme"; fg42.theme-package-name = lib.mkDefault "base16-theme";
fg42.vars = [ fg42.vars = [
(lib.defVar "theme" cfg.theme "The default font for FG42") (lib.defVar "font-name" cfg.font.name "The default font for FG42")
(lib.defVar "font-size" cfg.font.size "The default font size for FG42")
(lib.defVar "theme" cfg.theme "The default theme for FG42")
(lib.defVar "theme-package-name" cfg.theme-package-name '' (lib.defVar "theme-package-name" cfg.theme-package-name ''
The theme package name to use with FG42. The package should be added to `elispPackages` already. The theme package name to use with FG42. The package should be added to `elispPackages` already.
'') '')

View File

@ -40,8 +40,18 @@
(defmacro with-config (name &rest body) (defmacro with-config (name &rest body)
"Run the BODY only if the config NAME is set to t." "Run the BODY only if the config NAME is set to t."
(declare (indent defun)) (declare (indent defun))
`(when (string= (format "%s" (fg42/config-get-or ,name "")) "t") (if (string= (format "%s" (eval `(fg42/config-get-or ,name ""))) "t")
,@body)) `(progn
,@body)
nil))
(defmacro if-config (name then else)
"Eval THEN if the config NAME was t, otherwise ELSE."
(declare (indent defun))
(if (string= (eval `(fg42/config-get-or ,name "")) "t")
`,then
`,else))
(provide 'fg42/config) (provide 'fg42/config)