Compare commits

...

2 Commits

14 changed files with 367 additions and 24 deletions

View File

@ -253,16 +253,16 @@
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1712846008,
"narHash": "sha256-0739q1QSpprLrlqdmQeSM9ynqmuqHagmRLnyMEy47Xc=",
"ref": "refs/tags/v0.1.8",
"rev": "e53688bcc79e5e3142bb2c912d59965c086dafe4",
"revCount": 49,
"lastModified": 1713211987,
"narHash": "sha256-0Yx5n40Q6BymSRDxv4Bq/JRoXuDD4VJ/fTw2A55UbK8=",
"ref": "refs/tags/v0.1.9",
"rev": "f10112787fdf3e68b9dccf233c49d37b9e4b7d08",
"revCount": 50,
"type": "git",
"url": "https://devheroes.codes/lxsameer/noether"
},
"original": {
"ref": "refs/tags/v0.1.8",
"ref": "refs/tags/v0.1.9",
"type": "git",
"url": "https://devheroes.codes/lxsameer/noether"
}

View File

@ -17,7 +17,7 @@
description = "FG42 - Emacs Editor for advance users";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/442d407992384ed9c0e6d352de75b69079904e4e";
inputs.noether.url = "git+https://devheroes.codes/lxsameer/noether?ref=refs/tags/v0.1.8";
inputs.noether.url = "git+https://devheroes.codes/lxsameer/noether?ref=refs/tags/v0.1.9";
inputs.emacs-overlay.url = "github:nix-community/emacs-overlay/0f7f3b39157419f3035a2dad39fbaf8a4ba0448d";
inputs.flake-parts.url = "github:hercules-ci/flake-parts";
@ -50,9 +50,10 @@
'';
};
#noether = inputs.noether.outputs.packages.${system}.default;
fg42 = pkgs.callPackage ./nix/fg42 {
#extraModules = inputs.noether.outputs.fg42Modules.default;
extraPackages = {
noether = inputs.noether.outputs.packages.${system}.default;
};
};
run-test-wm = pkgs.writeShellApplication {
@ -64,9 +65,6 @@
'';
};
# factory = params: pkgs.callPackage ./nix/factory.nix ({ inherit noether; } // params);
# default = (factory { });
in
{
packages = {

View File

@ -80,6 +80,10 @@
(defvar build-state '()
"A list of expressions that will dump in the output at the end.")
(defvar vars ())
(defvar requires ())
(defvar build-output (cadr command-line-args-left))
;;; Build related stuff
@ -98,14 +102,14 @@
"Generate a list of `require' forms of ELISP-PKGS for compile time."
(when (> (length elisp-pkgs) 0)
(add-to-list
'build-state
'requires
`(eval-when-compile
,@(mapcar (lambda (pkg) `(require ',(intern pkg))) elisp-pkgs)))))
(defun generate-generic-vars (k v doc)
"Generate a list of vars for K and value V with docstring DOC."
(add-to-list 'build-state `(defvar ,(intern (format "fg42/config/%s" k)) ,v ,doc)))
(add-to-list 'vars `(defvar ,(intern (format "fg42/config/%s" k)) ,v ,doc)))
(defun fg42-config-key-handler (config)
@ -146,7 +150,10 @@ CONFIG maps to the collective `config' value of Nix modules."
(maphash #'handle-top-level j)
(with-temp-file build-output
(insert file-header)
(mapc (lambda (x) (print x (current-buffer))) build-state)
(insert ";; Vars ======")
(mapc (lambda (x) (print x (current-buffer))) vars)
(insert ";; Requires ======")
(mapc (lambda (x) (print x (current-buffer))) requires)
(insert file-footer))
(message "[build.el]: Done!"))

View File

@ -17,7 +17,12 @@
# This is the home manager module that exposes FG42. It differs
# from FG42 modules that are structurally the same but used in
# different context
{ pkgs, lib ? pkgs.lib, modules ? null, extraModules ? [ ] }:
{ pkgs
, lib ? pkgs.lib
, modules ? null
, extraModules ? [ ]
, extraPackages ? { }
}:
let
fg42Modules =
if modules != null
@ -36,6 +41,7 @@ let
specialArgs = {
inherit utils;
inherit (utils) makeFG42Drv;
inherit extraPackages;
};
};
in

View File

@ -104,6 +104,15 @@ in
'';
};
fg42.modeline = mkOption {
type = types.enum [ "emacs" "noether" ];
default = "emacs";
description = ''
What modeline mode to ues. Options are "emacs" for a normal modeline and
"noether" to disable Emacs's modeline and replace it by the noether mode.
'';
};
fg42.docstrings = mkOption {
type = types.attrsOf types.str;
readOnly = true;

View File

@ -19,7 +19,7 @@
# different context
# A list of default FG42 modules to build FG42 with.
{ lib, config, pkgs, makeFG42Drv, ... }:
{ lib, config, pkgs, makeFG42Drv, extraPackages, ... }:
let
deps =
(with pkgs.emacsPackages; [
@ -42,15 +42,23 @@ let
vertico
orderless
ctrlf
consult
marginalia
magit
forge
diff-hl
svg-tag-mode
all-the-icons
org
org-super-agenda
org-ql
org-modern
base16-theme
] ++ lib.optionals (config.fg42.emojify) [
emojify
] ++ lib.optionals (config.fg42.modeline == "noether") [
posframe
extraPackages.noether
]);
drv = makeFG42Drv {

View File

@ -40,7 +40,7 @@
(defmacro with-config (name &rest body)
"Run the BODY only if the config NAME is set to t."
(declare (indent defun))
`(when (fg42/config-get-or ,name)
`(when (string= (format "%s" (fg42/config-get-or ,name "")) "t")
,@body))

View File

@ -39,11 +39,10 @@
(require 'fg42/git)
;; (require 'fg42/wm)
(require 'fg42/org)
(require 'fg42/organize)
(require 'fg42/minibuffer)
(require 'fg42/graphics)
;; (require 'fg42/modeline)
)
(require 'fg42/modeline))
(require 'server)
(require 'fg42/utils)

View File

@ -0,0 +1,85 @@
;;; 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
:hook (emacs-startup . noether-global-mode)
:config
(require 'noether-views)
(require 'fg42/modeline/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))
;; Setup modelines
(when-not-wm
(setq-default noether-views (list fg42/modeline)))
(when-wm
(setq-default noether-views nil)))
(provide 'fg42/modeline-noether)
;;; modeline-noether.el ends here

View File

@ -0,0 +1,38 @@
;;; 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

@ -0,0 +1,90 @@
;;; 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 'noether)
(require 'noether-units)
(require 'projectile)
(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)))
(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
;; ============================================================================
(defvar fg42/-exwm-input-mode nil)
(defun fg42/-set-exwm-input-mode ()
"Set the EXWM input mode for the current buffer."
(setq fg42/-exwm-input-mode (format "%s" exwm--input-mode)))
(defun fg42/-format-exwm-input-mode (_ v _ _)
"Just return the input mode name V."
(if (=string v "line")
(propertize "L" 'font-lock-face `(:foreground ,(get-base16-color-or :base07 "eeeeec")))
(propertize "C" 'font-lock-face `(:foreground ,(get-base16-color-or :base0A "eeeeec")))))
(noether-defunit fg42/exwm-input-mode-unit
"Show the input mode of EXWM for the current buffer."
:label "I:"
:len 4
:init (lambda ()
(when (featurep 'exwm)
(add-hook 'noether-on-buffer-change-hook #'fg42/-set-exwm-input-mode)))
:deinit (lambda ()
(when (featurep 'exwm)
(remove-hook 'noether-on-buffer-change-hook #'fg42/-set-exwm-input-mode)))
:var 'fg42/-exwm-input-mode
:fn #'fg42/-format-exwm-input-mode)
(provide 'fg42/modeline/units)
;;; units.el ends here

View File

@ -0,0 +1,102 @@
;;; 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/modeline/units)
(defun fg42/--bottom-right (info)
"Keep the modeline at bottom right by using the data from INFO."
(cons -1 -1))
(defun fg42/--bottom-right-padded (info)
"Keep the modeline at bottom right by using the data from INFO."
(cons -70 -1))
(defun fg42/adjust-modeline (view)
"Adjust the VIEW after parent frame resize."
(noether-show view))
(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
:on-parent-resize #'fg42/adjust-modeline
:frame
(list
:right-fringe 5
:poshandler #'fg42/--bottom-right
:border-width 0
:font (format "%s %s" (car fg42/font) (- (cadr fg42/font) 1))
:border-color "#bd93f9")
:units
(list
(buffer-name-unit
:label (format "%s " (nerd-icons-codicon "nf-cod-layers"))
:len 20)
(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)
(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")))))
(noether-defview fg42/minimal-exwm
"A super simple bar containing the line number and column number that
Appears on the center of the current window."
:managed? t
:buffer "*exwm-status*"
:binding (kbd "C-c 1")
:separator " | "
:timeout 10
:frame
(list
:poshandler #'fg42/--bottom-right-padded
:border-width 0
:border-color "#bd93f9")
:units
(list
(fg42/exwm-input-mode-unit :label (format "%s " (nerd-icons-faicon "nf-fa-linux")))
(buffer-name-unit
:label (format "%s " (nerd-icons-codicon "nf-cod-layers"))
:len 30)
(time-unit :label (format "%s " (nerd-icons-mdicon "nf-md-clock_time_three")))))
(provide 'fg42/modeline/views)
;;; views.el ends here

View File

@ -24,6 +24,7 @@
(eval-when-compile
(require 'fpkg))
(defvar fg42/org-super-agenda-groups nil)
(defvar fg42/org-home "~/.orgs"
@ -153,5 +154,5 @@ For more info on ~org-mode~ check out `https://orgmode.org/'"
(org-agenda-finalize . org-modern-mode)))
(provide 'fg42/org)
;;; org.el ends here
(provide 'fg42/organize)
;;; organize.el ends here

View File

@ -26,7 +26,7 @@
;;; Code:
(require 'map)
(eval-when-compile
(require 'fg42-config))
(require 'fg42/config))
(defvar package-names ())