diff --git a/flake.lock b/flake.lock index 5134e93..09166e0 100644 --- a/flake.lock +++ b/flake.lock @@ -253,16 +253,16 @@ "nixpkgs": "nixpkgs_4" }, "locked": { - "lastModified": 1712755154, - "narHash": "sha256-ilCQqdi203dGpAhEh6EBL5Foxo2Bxu/Vhbz+0NBNmIc=", + "lastModified": 1712776989, + "narHash": "sha256-DiZoTYM8FptB4DkyrzdFDMDIMECNCdYpnthjhi0NaRs=", "ref": "refs/heads/main", - "rev": "e6f3fd58ab283867733e940d1287923e6f0efae4", - "revCount": 46, + "rev": "5241f9f243cb6099a185db12552a32f70509ada6", + "revCount": 48, "type": "git", "url": "https://devheroes.codes/lxsameer/noether" }, "original": { - "rev": "e6f3fd58ab283867733e940d1287923e6f0efae4", + "rev": "5241f9f243cb6099a185db12552a32f70509ada6", "type": "git", "url": "https://devheroes.codes/lxsameer/noether" } diff --git a/flake.nix b/flake.nix index 727f3f2..c6c57be 100644 --- a/flake.nix +++ b/flake.nix @@ -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?rev=e6f3fd58ab283867733e940d1287923e6f0efae4"; + inputs.noether.url = "git+https://devheroes.codes/lxsameer/noether?rev=5241f9f243cb6099a185db12552a32f70509ada6"; inputs.emacs-overlay.url = "github:nix-community/emacs-overlay/0f7f3b39157419f3035a2dad39fbaf8a4ba0448d"; inputs.flake-parts.url = "github:hercules-ci/flake-parts"; @@ -46,8 +46,10 @@ default = default.fg42; } // (pkgs.lib.optionalAttrs (system == "x86_64-linux") { # Gtk causes a flickering issue on WM mode - wm = (factory { emacsParams.toolkit = "lucid"; }).fg42; - motif = (factory { emacsParams.toolkit = "motif"; }).fg42; + lucid = (factory { emacsParams.toolkit = "lucid"; }).fg42; + gtk3 = (factory { emacsParams.withGTK3 = true; }).fg42; + pgtk = (factory { emacsParams.withPgtk = true; }).fg42; + gtk2 = (factory { emacsParams.withGTK2 = true; }).fg42; }); devShells.default = pkgs.mkShell { diff --git a/lisp/fg42/editor.el b/lisp/fg42/editor.el index ea4df65..5375405 100644 --- a/lisp/fg42/editor.el +++ b/lisp/fg42/editor.el @@ -42,7 +42,6 @@ (require 'server) - (defvar fg42/font '("Fira Mono" 12) "Font name and size to be used with FG42. (Default (\"Fira Mono\" 12).") diff --git a/lisp/fg42/modeline.el b/lisp/fg42/modeline.el index 6a37397..14221be 100644 --- a/lisp/fg42/modeline.el +++ b/lisp/fg42/modeline.el @@ -74,68 +74,13 @@ to Emacs modeline." (default-value 'face-remapping-alist) face-remaps)) (when-not-wm - (require 'noether-units) - (require 'nerd-icons) - (require 'projectile) + (require 'fg42/modeline/views) - (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-not-wm + (setq-default noether-views (list fg42/modeline)))) (when-wm - (setq-default noether-views (list noether-minimal-exwm)))) + (setq-default noether-views (list fg42/minimal-exwm)))) (provide 'fg42/modeline) ;;; modeline.el ends here diff --git a/lisp/fg42/modeline/units.el b/lisp/fg42/modeline/units.el new file mode 100644 index 0000000..94b93fd --- /dev/null +++ b/lisp/fg42/modeline/units.el @@ -0,0 +1,87 @@ +;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- +;; +;; Copyright (c) 2010-2024 Sameer Rahmani +;; +;; Author: Sameer Rahmani +;; 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 . +;; +;;; 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." + (nerd-icons-icon-for-mode v)) + + +(noether-defunit fg42/mode-icon + "Draws an icon for the current major mode." + :label "" + :len 1 + :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." + v) + + +(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 diff --git a/lisp/fg42/modeline/views.el b/lisp/fg42/modeline/views.el new file mode 100644 index 0000000..2e55c11 --- /dev/null +++ b/lisp/fg42/modeline/views.el @@ -0,0 +1,83 @@ +;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- +;; +;; Copyright (c) 2010-2024 Sameer Rahmani +;; +;; Author: Sameer Rahmani +;; 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 . +;; +;;; Commentary: +;;; Code: +(eval-when-compile + (require 'fpkg)) + +(require 'fg42/modeline/units) + +(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) + (fg42/mode-icon) + (line-unit :label ""))) + + +(when-wm + (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 3") + :separator "|" + :frame + (list + ;; Such a big numbers for X and Y will cause the frame to appear on the + ;; bottom right corner and covering the minibuffer + :position '(10000 . 10000) + :border-width 0 + :timeout 5 + :border-color "#bd93f9") + + :units + (list + (fg42/exwm-input-mode-unit :label "") + (buffer-name-unit :label "") + (time-unit :label "")))) + + +(provide 'fg42/modeline/views) +;;; views.el ends here diff --git a/nix/factory.nix b/nix/factory.nix index 3177b61..34ddef5 100644 --- a/nix/factory.nix +++ b/nix/factory.nix @@ -18,9 +18,9 @@ fg42Params ? {} } : let - lemacs = emacs29.override { + lemacs = emacs29.override ({ withTreeSitter = true; - } // emacsParams; + } // emacsParams); elispDepsFile = ../lisp/fg42/deps.el;