summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorSam Steingold <sds@gnu.org>2012-12-12 09:43:45 -0500
committerSam Steingold <sds@gnu.org>2012-12-12 09:43:45 -0500
commit37f38bca1dbcce25b4f41928a249ecf937d795ff (patch)
treec85378baeca37af3d5bec91d4ae11643fb66df5f /lisp
parentfd49a2185ff4f1710bc337168fd15af91064a74e (diff)
downloademacs-37f38bca1dbcce25b4f41928a249ecf937d795ff.tar.gz
emacs-37f38bca1dbcce25b4f41928a249ecf937d795ff.tar.bz2
emacs-37f38bca1dbcce25b4f41928a249ecf937d795ff.zip
* lisp/frame.el (frame-maximization-style): New user option.
(toggle-frame-maximized): Toggle frame maximization according to `frame-maximization-style', bound to <f11>. (cycle-frame-maximized): Cycle between all maximization styles and non-maximized frame, bound to shift-<f11>.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/frame.el30
2 files changed, 38 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a5fab65b34f..adf8d9f88f0 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
+2012-12-12 Sam Steingold <sds@gnu.org>
+
+ * frame.el (frame-maximization-style): New user option.
+ (toggle-frame-maximized): Toggle frame maximization according to
+ `frame-maximization-style', bound to <f11>.
+ (cycle-frame-maximized): Cycle between all maximization styles and
+ non-maximized frame, bound to shift-<f11>.
+
2012-12-12 David Cadé <codename68@gmail.com>
* mpc.el (mpc-format): Use truncate-string-to-width (bug#13143).
diff --git a/lisp/frame.el b/lisp/frame.el
index 7a54efc23e7..559aa35242d 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -1654,12 +1654,42 @@ terminals, cursor blinking is controlled by the terminal."
'blink-cursor-start))))
+;; Frame maximization
+(defcustom frame-maximization-style 'maximized
+ "The maximization style of \\[toggle-frame-maximized]."
+ :version "24.4"
+ :type '(choice
+ (const :tab "Respect window manager screen decorations." maximized)
+ (const :tab "Ignore window manager screen decorations." fullscreen))
+ :group 'frames)
+
+(defun toggle-frame-maximized ()
+ "Maximize/un-maximize Emacs frame according to `frame-maximization-style'.
+See also `cycle-frame-maximized'."
+ (interactive)
+ (modify-frame-parameters
+ nil `((fullscreen . ,(if (frame-parameter nil 'fullscreen)
+ nil frame-maximization-style)))))
+
+(defun cycle-frame-maximized ()
+ "Cycle Emacs frame between normal, maximized, and fullscreen.
+See also `toggle-frame-maximized'."
+ (interactive)
+ (modify-frame-parameters
+ nil `((fullscreen . ,(cl-case (frame-parameter nil 'fullscreen)
+ ((nil) 'maximized)
+ ((maximized) 'fullscreen)
+ ((fullscreen) nil))))))
+
+
;;;; Key bindings
(define-key ctl-x-5-map "2" 'make-frame-command)
(define-key ctl-x-5-map "1" 'delete-other-frames)
(define-key ctl-x-5-map "0" 'delete-frame)
(define-key ctl-x-5-map "o" 'other-frame)
+(define-key global-map [f11] 'toggle-frame-maximized)
+(define-key global-map [(shift f11)] 'cycle-frame-maximized)
;; Misc.