88 lines
2.6 KiB
EmacsLisp
88 lines
2.6 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 '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."
|
|
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
|