Advertisement
Guest User

Untitled

a guest
Sep 8th, 2023
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 1.01 KB | Source Code | 0 0
  1. ;; if i alway open new buffer it works virtually perfect
  2. ;; we have to be sure to disable the modeline for that window
  3. ;; so the other buffers could still have it if their position say so
  4.  
  5. (defun window-touches-bottom-p (win)
  6.   "Check if WIN is touching the bottom of the frame."
  7.   (let* ((edges (window-edges win nil t t))
  8.          (bottom-edge (nth 3 edges))
  9.          (frame-height (frame-pixel-height))
  10.          ;; Define a tolerance of 10 pixels
  11.          (tolerance 10))
  12.     ;; Check if the window's bottom edge is within the tolerance of the frame's height
  13.     (<= (abs (- bottom-edge frame-height)) tolerance)))
  14.  
  15. (defun adjust-modelines-based-on-geometry ()
  16.   "Adjust modelines based on window geometry."
  17.   (dolist (win (window-list))
  18.     (with-selected-window win
  19.       (if (window-touches-bottom-p win)
  20.           (setq-local mode-line-format (default-value 'mode-line-format))
  21.         (setq-local mode-line-format nil)))))
  22.  
  23. (add-hook 'window-configuration-change-hook 'adjust-modelines-based-on-geometry)
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement