使用elisp将Emacs窗口最大化到一个屏幕

12

我使用maxframe.el来最大化我的Emacs窗口。

这个插件在三个主要平台上都很好用,只有在我的双屏Mac设置(Macbook Pro 15英寸笔记本电脑和23英寸显示器)上出现了问题。

当我最大化一个Emacs窗口时,它会扩展到填满两个监视器的宽度和较大监视器的高度。

显然,我希望窗口只最大化到所在的单个监视器。 如何使用Emacs Lisp检测两个独立显示器的分辨率?

谢谢, Jacob

编辑:正如Denis指出的那样,设置mf-max-width是一个合理的解决方法。但是(正如我应该提到的那样),我希望找到一种适用于任何分辨率且适用于两个监视器的解决方案。也许是类似于在Windows中使用w32-send-sys-command的OSX特定解决方案。

3个回答

8

我快速浏览了您提供的maxframe.el参考资料,我认为您没有使用我使用的相同技术。下面的代码片段是否对您有所帮助?


(defun toggle-fullscreen ()
  "toggles whether the currently selected frame consumes the entire display or is decorated with a window border"
  (interactive)
  (let ((f (selected-frame)))
    (modify-frame-parameters f `((fullscreen . ,(if (eq nil (frame-parameter f 'fullscreen)) 'fullboth nil))))))

太棒了!你是对的,这是完全不同的解决方案,但更好,因为它还可以摆脱 dock 和菜单栏。不幸的是,它只在我双屏设置的大显示器上有效,但我认为在这种情况下优点大于缺点。谢谢! - Chopmo
不幸的是,这似乎无法在http://emacsformacosx.com/上使用 - 是否有任何已知的解决'ns'窗口系统的方法? - Glyph
这对于 mac 窗口系统确实有效,谢天谢地,我能够使用它来替换 ediff-toggle-wide-display:https://gist.github.com/1283061 - Nicholas Riley

4

自定义 `mf-max-width' 是否有效?它的文档:

"*The maximum display width to support.  This helps better support the true
nature of display-pixel-width.  Since multiple monitors will result in a
very large display pixel width, this value is used to set the stop point for
maximizing the frame.  This could also be used to set a fixed frame size
without going over the display dimensions."

-2
这种事情应该由你的窗口管理器来处理,而不是emacs的工作。 (例如,Xmonad可以很好地处理全屏emacs。)

同意..但是在启动时,Emacs似乎无法理解XMonad给他的窗口尺寸。因此,我不得不在一些布局之间切换,让Emacs理解它的尺寸。 - Rene Saarsoo

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接