Fix the modeline view to reposition on resize
This commit is contained in:
parent
dc949d26c4
commit
f27b43c3d0
11
flake.lock
11
flake.lock
|
@ -253,15 +253,16 @@
|
||||||
"nixpkgs": "nixpkgs_4"
|
"nixpkgs": "nixpkgs_4"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1712776989,
|
"lastModified": 1712846008,
|
||||||
"narHash": "sha256-DiZoTYM8FptB4DkyrzdFDMDIMECNCdYpnthjhi0NaRs=",
|
"narHash": "sha256-0739q1QSpprLrlqdmQeSM9ynqmuqHagmRLnyMEy47Xc=",
|
||||||
"rev": "5241f9f243cb6099a185db12552a32f70509ada6",
|
"ref": "refs/tags/v0.1.8",
|
||||||
"revCount": 48,
|
"rev": "e53688bcc79e5e3142bb2c912d59965c086dafe4",
|
||||||
|
"revCount": 49,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://devheroes.codes/lxsameer/noether"
|
"url": "https://devheroes.codes/lxsameer/noether"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"rev": "5241f9f243cb6099a185db12552a32f70509ada6",
|
"ref": "refs/tags/v0.1.8",
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://devheroes.codes/lxsameer/noether"
|
"url": "https://devheroes.codes/lxsameer/noether"
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,8 @@
|
||||||
description = "FG42 - Emacs Editor for advance users";
|
description = "FG42 - Emacs Editor for advance users";
|
||||||
|
|
||||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/442d407992384ed9c0e6d352de75b69079904e4e";
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/442d407992384ed9c0e6d352de75b69079904e4e";
|
||||||
inputs.noether.url = "git+https://devheroes.codes/lxsameer/noether?rev=5241f9f243cb6099a185db12552a32f70509ada6";
|
inputs.noether.url = "git+https://devheroes.codes/lxsameer/noether?ref=refs/tags/v0.1.8";
|
||||||
|
|
||||||
inputs.emacs-overlay.url = "github:nix-community/emacs-overlay/0f7f3b39157419f3035a2dad39fbaf8a4ba0448d";
|
inputs.emacs-overlay.url = "github:nix-community/emacs-overlay/0f7f3b39157419f3035a2dad39fbaf8a4ba0448d";
|
||||||
inputs.flake-parts.url = "github:hercules-ci/flake-parts";
|
inputs.flake-parts.url = "github:hercules-ci/flake-parts";
|
||||||
|
|
||||||
|
@ -50,6 +51,7 @@
|
||||||
gtk3 = (factory { emacsParams.withGTK3 = true; }).fg42;
|
gtk3 = (factory { emacsParams.withGTK3 = true; }).fg42;
|
||||||
pgtk = (factory { emacsParams.withPgtk = true; }).fg42;
|
pgtk = (factory { emacsParams.withPgtk = true; }).fg42;
|
||||||
gtk2 = (factory { emacsParams.withGTK2 = true; }).fg42;
|
gtk2 = (factory { emacsParams.withGTK2 = true; }).fg42;
|
||||||
|
none = (factory { emacsParams.toolkit = "no"; }).fg42;
|
||||||
});
|
});
|
||||||
|
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
|
|
|
@ -256,6 +256,9 @@ shipped with Emacs."
|
||||||
(add-hook
|
(add-hook
|
||||||
'emacs-startup-hook
|
'emacs-startup-hook
|
||||||
(lambda ()
|
(lambda ()
|
||||||
|
;; It only applies to toolkit=no
|
||||||
|
(set-mouse-color (get-base16-color-or :base07 "#eeeeec"))
|
||||||
|
|
||||||
;; Switch from `dabbrev-expand' to `hippie-expand'
|
;; Switch from `dabbrev-expand' to `hippie-expand'
|
||||||
(global-set-key [remap dabbrev-expand] 'hippie-expand)
|
(global-set-key [remap dabbrev-expand] 'hippie-expand)
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@
|
||||||
(setq user-emacs-directory emacsd)
|
(setq user-emacs-directory emacsd)
|
||||||
(setq user-init-file
|
(setq user-init-file
|
||||||
(or (getenv "FG42_CONFIG_FILE")
|
(or (getenv "FG42_CONFIG_FILE")
|
||||||
(format "%s/.fg42.el"
|
(format "%s/.fg42.v4.el"
|
||||||
(getenv "HOME")))))
|
(getenv "HOME")))))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -39,13 +39,13 @@
|
||||||
|
|
||||||
(defun fg42/-format-mode-icon (_ v _ _)
|
(defun fg42/-format-mode-icon (_ v _ _)
|
||||||
"Format the icon V."
|
"Format the icon V."
|
||||||
(nerd-icons-icon-for-mode v))
|
(format " %s " (nerd-icons-icon-for-mode v)))
|
||||||
|
|
||||||
|
|
||||||
(noether-defunit fg42/mode-icon
|
(noether-defunit fg42/mode-icon
|
||||||
"Draws an icon for the current major mode."
|
"Draws an icon for the current major mode."
|
||||||
:label ""
|
:label ""
|
||||||
:len 1
|
:len 3
|
||||||
:init (lambda ()
|
:init (lambda ()
|
||||||
(add-hook 'post-command-hook #'fg42/-update-mode-icon))
|
(add-hook 'post-command-hook #'fg42/-update-mode-icon))
|
||||||
|
|
||||||
|
|
|
@ -26,33 +26,47 @@
|
||||||
|
|
||||||
(require 'fg42/modeline/units)
|
(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/adjust-modeline (view)
|
||||||
|
"Adjust the VIEW after parent frame resize."
|
||||||
|
(noether-show view))
|
||||||
|
|
||||||
|
|
||||||
(noether-defview fg42/modeline
|
(noether-defview fg42/modeline
|
||||||
"A simple and minimalist mode-line like status bar"
|
"A simple and minimalist mode-line like status bar"
|
||||||
:managed? t
|
:managed? t
|
||||||
:binding (kbd "C-c 0")
|
:binding (kbd "C-c 0")
|
||||||
:buffer "*modeline"
|
:buffer "*modeline*"
|
||||||
:visible? t
|
:visible? t
|
||||||
:timeout 0
|
:timeout 0
|
||||||
|
:on-parent-resize #'fg42/adjust-modeline
|
||||||
:frame
|
:frame
|
||||||
(list
|
(list
|
||||||
:position
|
:right-fringe 5
|
||||||
(cons (- (frame-inner-width) 690)
|
:poshandler #'fg42/--bottom-right
|
||||||
(- (frame-outer-height) 20))
|
|
||||||
:border-width 0
|
:border-width 0
|
||||||
|
:font (format "%s %s" (car fg42/font) (- (cadr fg42/font) 1))
|
||||||
:border-color "#bd93f9")
|
:border-color "#bd93f9")
|
||||||
|
|
||||||
:units
|
:units
|
||||||
(list
|
(list
|
||||||
(buffer-name-unit :label (format "%s " (nerd-icons-codicon "nf-cod-layers"))
|
(buffer-name-unit
|
||||||
:len 20)
|
:label (format "%s " (nerd-icons-codicon "nf-cod-layers"))
|
||||||
|
:len 20)
|
||||||
;; (mode-name-unit :label " " :len 4)
|
;; (mode-name-unit :label " " :len 4)
|
||||||
(projectile-project-unit :label (format "%s " (nerd-icons-octicon "nf-oct-project"))
|
(projectile-project-unit
|
||||||
:len 20)
|
:label (format "%s " (nerd-icons-octicon "nf-oct-project"))
|
||||||
(git-branch-unit :label (format "%s " (nerd-icons-devicon "nf-dev-git_branch"))
|
:len 20)
|
||||||
:len 20)
|
(git-branch-unit
|
||||||
|
:label (format "%s " (nerd-icons-devicon "nf-dev-git_branch"))
|
||||||
|
:len 20)
|
||||||
(fg42/mode-icon)
|
(fg42/mode-icon)
|
||||||
(line-unit :label "")))
|
(line-unit :label (format "%s " (nerd-icons-codicon "nf-cod-location")))))
|
||||||
|
|
||||||
|
|
||||||
(when-wm
|
(when-wm
|
||||||
|
@ -67,7 +81,7 @@ Appears on the center of the current window."
|
||||||
(list
|
(list
|
||||||
;; Such a big numbers for X and Y will cause the frame to appear on the
|
;; Such a big numbers for X and Y will cause the frame to appear on the
|
||||||
;; bottom right corner and covering the minibuffer
|
;; bottom right corner and covering the minibuffer
|
||||||
:position '(10000 . 10000)
|
:position '(-30 . -1)
|
||||||
:border-width 0
|
:border-width 0
|
||||||
:timeout 5
|
:timeout 5
|
||||||
:border-color "#bd93f9")
|
:border-color "#bd93f9")
|
||||||
|
|
Loading…
Reference in New Issue