Fix the parent frame resize issue

This commit is contained in:
Sameer Rahmani 2024-04-10 20:23:09 +01:00
parent cdb0c41573
commit 5241f9f243
Signed by: lxsameer
GPG Key ID: 8741FACBF412FFA5
4 changed files with 30 additions and 6 deletions

View File

@ -53,7 +53,7 @@
noether = pkgs.emacsPackages.trivialBuild {
pname = "noether-mode";
version = "0.1.6";
version = "0.1.7";
buildInputs = [ pkgs.emacsPackages.posframe ];
src = ./.;
@ -81,6 +81,11 @@
buildInputs = [ noether emacsPkgs ];
};
apps.default = {
type = "app";
program = "${test-noether}/bin/test-noether";
};
};
});

View File

@ -28,7 +28,6 @@
(require 'noether)
(require 'noether-units)
(noether-defview noether-minimal-mode-line
"A simple and minimalist mode-line like status bar"
:managed? t

View File

@ -318,6 +318,14 @@ It removes any possible watch function."
(funcall deinit)))
(defun noether-refresh (&optional _)
"Refresh views.
We need to call this function when ever Emacs resized
or the font size changed."
(interactive)
(mapc #'noether--setup-views noether-views))
(defun noether--teardown-views (view)
"Tear down the given VIEW to avoid any zombie watcher or timer n stuff."
(let ((name (noether--view-get view :name)))
@ -333,13 +341,19 @@ It removes any possible watch function."
"Enable noether by setting up each view and necessary hooks."
(add-to-list 'window-buffer-change-functions #'noether--buffer-focus-change-runner)
(add-to-list 'window-selection-change-functions #'noether--buffer-focus-change-runner)
(mapc #'noether--setup-views noether-views))
(add-to-list 'window-size-change-functions #'noether-refresh)
;; Technically the argument to the refresh function should be a `frame'
;; but since we are not using it and we have to keep it cuz
;; `window-size-change-functions' expects it, We just pass true.
(noether-refresh t))
(defun noether--disable ()
"Disable noether and clean up after it."
(delete #'noether--buffer-focus-change-runner window-buffer-change-functions)
(delete #'noether--buffer-focus-change-runner window-selection-change-functions)
(delete #'noether-refresh window-size-change-functions)
(mapc #'noether--teardown-views noether-views))

View File

@ -34,6 +34,11 @@
(require 'noether-units)
(require 'noether-views)
(defun noether--bottom-right (info)
(cons (- (frame-outer-width) 10)
(- (frame-outer-height) 40))
)
(noether-defview mode-line
"A simple and minimalist mode-line like status bar"
:managed? t
@ -44,10 +49,11 @@
:visible? t
:frame
(list
:position (cons (- (frame-outer-width) 10)
(- (frame-outer-height) 40))
;;:poshandler #'posframe-poshandler-frame-top-center
;; :position (cons (- (frame-outer-width) 10)
;; (- (frame-outer-height) 40))
:poshandler #'noether--bottom-right
:border-width 0
:border-color "#bd93f9")
:units