1

When I maximise an Emacs frame, it fills almost, but not quite all the available space. I can still wiggle the frame around and a sliver of the desktop beneath is showing. Desktop environment is KDE 5.

Screenshot shows the right-most edge of the screen.

  • Is this with non-nil (display-graphic-p), i.e., using GUI Emacs frames, or is it with Emacs in console mode? Just how did you try to maximize the frame? A recipe will likely lead to better help. – Drew May 13 '17 at 15:05
  • This is GUI. All GUIs I have ever used have a button on the window decoration to maximise a window. It's visible right there in the screenshot, upper right corner below the clock. – daxim May 13 '17 at 15:08
  • So you're using the maximize button that is part of the window-manager window. This doesn't sound like it has anything to do with Emacs, in that case. Do you not see the same behavior with other, non-Emacs, window-manager windows? If you see this for Emacs only, it sounds like a bug: M-x report-emacs-bug. – Drew May 13 '17 at 15:11
  • 1
    First, make sure you are using Emacs 25 and then try M-x toggle-frame-maximized and see if you have any luck. I gave up on having Emacs calculate it exactly (without any help from the user) and have been using my own recipe, in conjunction with implemented feature request 21415, to fill the entire screen: emacs.stackexchange.com/a/20220/2287 I have a custom function to shrink and maximize. If you decide to implement something similar, set-frame-size has an optional PIXELWISE argument: gnu.org/software/emacs/manual/html_node/elisp/… – lawlist May 13 '17 at 15:49
  • 1
    lawlist, setting the option frame-resize-pixelwise does what I want without any further programming. Please change the last part of your comment with the documentation into an answer so that I can accept it. – daxim May 13 '17 at 16:05
5

The original poster has indicated that setting frame-resize-pixelwise solved the issue:

— User Option: frame-resize-pixelwise

    If this option is nil, a frame's size is usually rounded to a multiple of the
current values of that frame's frame-char-height and frame-char-width whenever
the frame is resized. If this is non-nil, no rounding occurs, hence frame sizes
can increase/decrease by one pixel.

    Setting this variable usually causes the next resize operation to pass the
corresponding size hints to the window manager. This means that this variable
should be set only in a user's initial file; applications should never bind it
temporarily.

    The precise meaning of a value of nil for this option depends on the toolkit
used. Dragging the external border with the mouse is done character-wise provided
the window manager is willing to process the corresponding size hints. Calling
set-frame-size (see below) with arguments that do not specify the frame size as
an integer multiple of its character size, however, may: be ignored, cause a
rounding (GTK+), or be accepted (Lucid, Motif, MS-Windows).

    With some window managers you may have to set this to non-nil in order to
make a frame appear truly maximized or full-screen. 
0

Depending on exactly what you mean by maximized, you can use either toggle-frame-fullscreen or toggle-frame-maximized to achieve it through elisp (or M-x ...). Note, as @lawlist's answer points out, you may need to adjust frame-resize-pixelwise.

Here are the relevant docstrings. First, the "fullscreen" version:

(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.

Note that with some window managers you may have to set frame-resize-pixelwise to non-nil in order to make a frame appear truly fullscreen.

See also toggle-frame-maximized.

And the "maximized" version:

(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.

Note that with some window managers you may have to set frame-resize-pixelwise to non-nil in order to make a frame appear truly maximized.

See also toggle-frame-fullscreen.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.