help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: maximising window?


From: Michael Heerdegen
Subject: Re: maximising window?
Date: Sun, 08 Jun 2014 17:02:18 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.91 (gnu/linux)

James Freer <jessejazza3.uk@gmail.com> writes:

> One thing I want to enter in the .emacs is the equivalent of
> alt+f10. Maximise 'window' isn't quite the same from what I've read
> this evening... in emacs they're frames. Vary depending on Mac, linux
> or windows - I'm using Linux Xubuntu on a CRT monitor.

If you want to do it for all new frames, `default-frame-alist' is the
right place:

    (add-to-list 'default-frame-alist '(fullscreen . maximized))

See (info "(elisp) Frame Parameters") for details.

Interactively: `toggle-frame-maximized', `toggle-frame-fullscreen', as
it had been suggested.  For older Emacsen, you can simply write your own
commands using `modify-frame-parameters'.  These definitions from
frame.el should work in Emacs 23, too:

--8<---------------cut here---------------start------------->8---
(defun toggle-frame-maximized ()
  "Toggle maximization state of the selected frame.
Maximize the selected frame or un-maximize if it is already maximized.
Respect window manager screen decorations.
If the frame is in fullscreen mode, don't change its mode,
just toggle the temporary frame parameter `maximized',
so the frame will go to the right maximization state
after disabling fullscreen mode.
See also `toggle-frame-fullscreen'."
  (interactive)
  (if (memq (frame-parameter nil 'fullscreen) '(fullscreen fullboth))
      (modify-frame-parameters
       nil
       `((maximized
          . ,(unless (eq (frame-parameter nil 'maximized) 'maximized)
               'maximized))))
    (modify-frame-parameters
     nil
     `((fullscreen
        . ,(unless (eq (frame-parameter nil 'fullscreen) 'maximized)
             'maximized))))))

(defun toggle-frame-fullscreen ()
  "Toggle fullscreen mode of the selected frame.
Enable fullscreen mode of the selected frame or disable if it is
already fullscreen.  Ignore window manager screen decorations.
When turning on fullscreen mode, remember the previous value of the
maximization state in the temporary frame parameter `maximized'.
Restore the maximization state when turning off fullscreen mode.
See also `toggle-frame-maximized'."
  (interactive)
  (modify-frame-parameters
   nil
   `((maximized
      . ,(unless (memq (frame-parameter nil 'fullscreen) '(fullscreen fullboth))
           (frame-parameter nil 'fullscreen)))
     (fullscreen
      . ,(if (memq (frame-parameter nil 'fullscreen) '(fullscreen fullboth))
             (if (eq (frame-parameter nil 'maximized) 'maximized)
                 'maximized)
           'fullscreen)))))
--8<---------------cut here---------------end--------------->8---


Michael.




reply via email to

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