-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwinsize.el
48 lines (37 loc) · 1.5 KB
/
winsize.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
;;; winsize --- a simple package for resizing windows -*- lexical-binding: t; -*-
;; Copyright (C) 2021 Patrik Olin
;; Author: Patrik Olin <[email protected]>
;; Version: 0.0.1
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;; Code:
(setq winsize--perc 0.50)
;;;###autoload
(defun winsize-incremental-resize ()
"Resize current window to 25/50/75% of the current frame."
(interactive)
(let ((delta-lines (round(* winsize--perc (frame-height)))))
(when (window-resizable nil delta-lines)
(window-resize nil (- delta-lines (window-total-height)))
(winsize--modify-perc)
)
)
)
(defun winsize--modify-perc ()
"Increase and decrease value of winsize--perc variable."
(setq winsize--perc (if (equal winsize--perc 0.75)
0.25
(+ winsize--perc 0.25))
)
)
(provide 'winsize)
;;; winsize.el ends here