forked from fgeller/emacs-init
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit-maxframe.el
43 lines (35 loc) · 1.41 KB
/
init-maxframe.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
(dolist (sym '(mf-max-display-pixel-width
mf-max-display-pixel-height
maximize-frame
restore-frame))
(autoload sym "maxframe"))
(when *is-cocoa-emacs*
(eval-after-load 'maxframe
'(progn
(fset 'maximize-frame 'x-maximize-frame)
(fset 'restore-frame 'x-restore-frame))))
(when *macbook-pro-support-enabled*
(setq mf-max-width 1440
mf-max-height 894
mf-display-padding-width 4
mf-offset-x 0
mf-display-padding-height (if (when (boundp 'ns-auto-hide-menu-bar)
ns-auto-hide-menu-bar)
23
(+ 22 23))))
(defun maybe-maximize-frame (&optional frame)
(with-selected-frame frame
(if window-system (maximize-frame))))
(add-hook 'after-make-frame-functions 'maybe-maximize-frame)
(add-hook 'after-init-hook 'maybe-maximize-frame)
(defun within-p (a b delta)
(<= (abs (- b a)) delta))
(defun maximized-p (&optional frame)
(or (not (with-selected-frame frame window-system))
(and (within-p (mf-max-display-pixel-width)
(frame-pixel-width frame)
(frame-char-width frame))
(within-p (mf-max-display-pixel-height)
(+ mf-display-padding-height (frame-pixel-height frame))
(frame-char-height frame)))))
(provide 'init-maxframe)