[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/golden-ratio 76f5307ad0 72/95: Merge pull request #43 from
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/golden-ratio 76f5307ad0 72/95: Merge pull request #43 from EricGebhart/master |
Date: |
Thu, 7 Sep 2023 22:02:14 -0400 (EDT) |
branch: elpa/golden-ratio
commit 76f5307ad04eeb912f11d990cc9ec6320afd60a3
Merge: 6173b7c416 26f616f658
Author: Roman Gonzalez <roman@users.noreply.github.com>
Commit: Roman Gonzalez <roman@users.noreply.github.com>
Merge pull request #43 from EricGebhart/master
scaling of width for wide frames.
---
README.md | 36 ++++++++++++++++++++++++++++++++++++
golden-ratio.el | 42 +++++++++++++++++++++++++++++++++++++++++-
2 files changed, 77 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 65eb80020f..9a7b913bfb 100644
--- a/README.md
+++ b/README.md
@@ -36,6 +36,42 @@ If you want to disable automatic resizing done by
golden-ratio, just invoke
To call golden ratio manually just `M-x golden-ratio`
+## Wide Screens
+
+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`
+
+It is also possible to toggle between widescreen and regular width window
sizing
+with
+
+`M-x golden-ratio-toggle-widescreen`
+
+The variable _golden-ratio-wide-adjust-factor_ can be set to the adjustment
value
+you desire the widescreen toggle to use.
+
+The following code will set up golden-ratio to adjust for a moderately wide
screen
+and also allow toggling between normal, with an adjustment factor of 1, and
wide with
+an adjustment factor of .8. For a very wide screen/frame of ~3400 px, .4 works
well giving
+screens with a width ~100 columns wide.
+
+```elisp
+(setq golden-ratio-adjust-factor .8
+ golden-ratio-wide-adjust-factor .8)
+```
+
## Credits
Code inspired by ideas from [Tatsuhiro Ujihisa](http://twitter.com/ujm)
diff --git a/golden-ratio.el b/golden-ratio.el
index b28e88bb75..2fd65814a6 100644
--- a/golden-ratio.el
+++ b/golden-ratio.el
@@ -62,14 +62,54 @@ will not cause the window to be resized to the golden
ratio."
:group 'golden-ratio
:type 'boolean)
+(defcustom golden-ratio-adjust-factor 1.0
+ "Adjust the width sizing by some factor. 1 is no adjustment.
+ For very wide screens/frames, ie. 3400px, .4 may work well."
+ :group 'golden-ratio
+ :type 'integer)
+
+(defcustom golden-ratio-wide-adjust-factor 0.8
+ "Width adjustment factor for widescreens. Used when
+ toggling between widescreen and regular modes."
+ :group 'golden-ratio
+ :type 'float)
+
+(defcustom golden-ratio-auto-scale nil
+ "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)
(defalias 'window-resizable-p 'window--resizable-p))
+(defun golden-ratio-toggle-widescreen ()
+ (interactive)
+ (if (= golden-ratio-adjust-factor 1)
+ (setq golden-ratio-adjust-factor golden-ratio-wide-adjust-factor)
+ (setq golden-ratio-adjust-factor 1))
+ (golden-ratio))
+
+(defun golden-ratio-adjust (a)
+ "set the adjustment of window widths."
+ (interactive
+ (list
+ (read-number "Screeen width adjustment factor: "
golden-ratio-adjust-factor)))
+ (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))))
+ (floor (* (/ (frame-width) golden-ratio--value)
+ (golden-ratio--scale-factor)))))
(defun golden-ratio--resize-window (dimensions &optional window)
(with-selected-window (or window (selected-window))
- [nongnu] elpa/golden-ratio f4c0dbb164 52/95: Revert "Add one extra advice to golden-ratio for window-numbering.el support", (continued)
- [nongnu] elpa/golden-ratio f4c0dbb164 52/95: Revert "Add one extra advice to golden-ratio for window-numbering.el support", ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio 33aa083b66 56/95: Merge pull request #33 from thierryvolpiatto/master, ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio cbd076aa12 62/95: Merge pull request #34 from hickinbottoms/fix-mouse-window-select, ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio 6173b7c416 64/95: Prevent recenter error in post-command-hook for emacs-25., ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio 64ceb4f0c8 68/95: Added widescreens header to readme., ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio c506ddc04a 66/95: Added explanation of golden-ratio-adjust., ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio b343baac28 69/95: Added automatic scaling of width according to frame size., ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio d5413c832b 75/95: Fix types in golden-ratio-exclude-modes., ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio e47c29f87e 78/95: Trigger after split-window as well, ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio f7bee8e221 65/95: Added width adjustment to adjust for very wide frames., ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio 76f5307ad0 72/95: Merge pull request #43 from EricGebhart/master,
ELPA Syncer <=
- [nongnu] elpa/golden-ratio 0287ac76fd 76/95: Simplify `golden-ratio-mode', ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio 7593ba59b3 79/95: Merge pull request #48 from abo-abo/master, ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio ac9bcedc63 81/95: Reenable improvements removed by error when reverting last PR., ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio 5e5b6c805b 85/95: Call window-configuration-change-hook only once, after the golden-ratio command., ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio c5e916d238 86/95: Add fixed width feature, ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio f5807212d3 88/95: Merge pull request #81 from wictory/pr_20190406, ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio 1325ecac07 92/95: support minimal change, ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio 656117e490 93/95: change default minimal change to 1, ELPA Syncer, 2023/09/07
- [nongnu] elpa/golden-ratio bf0035fd6a 95/95: Merge pull request #89 from skangas/nongnu-elpa-fixes, ELPA Syncer, 2023/09/07