emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/golden-ratio b343baac28 69/95: Added automatic scaling of


From: ELPA Syncer
Subject: [nongnu] elpa/golden-ratio b343baac28 69/95: Added automatic scaling of width according to frame size.
Date: Thu, 7 Sep 2023 22:02:14 -0400 (EDT)

branch: elpa/golden-ratio
commit b343baac288db0cb2ea5094b597414a7c754b8bc
Author: EricGebhart <e.a.gebhart@gmail.com>
Commit: EricGebhart <e.a.gebhart@gmail.com>

    Added automatic scaling of width according to frame size.
---
 README.md       | 14 ++++++++++++--
 golden-ratio.el | 14 +++++++++++++-
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index f8406f5040..9a7b913bfb 100644
--- a/README.md
+++ b/README.md
@@ -38,8 +38,18 @@ To call golden ratio manually just `M-x golden-ratio`
 
 ## Wide Screens
 
-If you use a large screen and have very wide frames, setting the 
_golden-ratio-adjust-factor_
-variable to something less than 1 will cause the windows to be less wide.
+If you use a large screen and have very wide frames golden-ratio makes very 
+wide windows. This can be handled automatically by setting 
_golden-ratio-auto-scale_
+to true. This does a good job of keeping windows at a reasonable width 
regardless of
+how wide or narrow your frame size is. This works well on my laptop regardless 
of
+which monitor or LCD I happen to be using.
+
+`(setq golden-ratio-auto-scale t)` 
+
+For those who wish for manual control,
+If _golden-ratio-auto-scale_ is false, manual control can be exercised
+through the _golden-ratio-adjust-factor_ variable.
+setting it to something less than 1 will cause the windows to be less wide.
 The golden-ratio-adjust function allows for experimentation with this value.
 
 `M-x golden-ratio-adjust` 
diff --git a/golden-ratio.el b/golden-ratio.el
index 6cd24c2f9d..fb7fb4f70d 100644
--- a/golden-ratio.el
+++ b/golden-ratio.el
@@ -74,6 +74,13 @@ will not cause the window to be resized to the golden ratio."
   :group 'golden-ratio
   :type 'float)
 
+(defcustom golden-ratio-auto-scale f
+  "Automatic width adjustment factoring. Scales the width
+   of the screens to be smaller as the frame gets bigger."
+  :group 'golden-ratio
+  :type 'boolean)
+
+
 ;;; Compatibility
 ;;
 (unless (fboundp 'window-resizable-p)
@@ -94,10 +101,15 @@ will not cause the window to be resized to the golden 
ratio."
   (setq golden-ratio-adjust-factor a)
   (golden-ratio))
 
+(defun golden-ratio--scale-factor ()
+  (if golden-ratio-auto-scale
+      (- 1.0 (* (/ (- (frame-width) 100.0) 1000.0) 1.8))
+    golden-ratio-adjust-factor))
+
 (defun golden-ratio--dimensions ()
   (list (floor (/ (frame-height) golden-ratio--value))
         (floor  (* (/ (frame-width)  golden-ratio--value)
-                   golden-ratio-adjust-factor))))
+                   (golden-ratio--scale-factor)))))
 
 (defun golden-ratio--resize-window (dimensions &optional window)
   (with-selected-window (or window (selected-window))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]