使用 elisp 将 Emacs 框架最大化到一台显示器

发布于 2024-07-05 02:33:19 字数 493 浏览 9 评论 0原文

我使用 maxframe.el 来最大化我的 Emacs 框架。

它在所有三个主要平台上都表现良好,除了我的双头 Mac 设置(Macbook Pro 15 英寸笔记本电脑和 23 英寸显示器)。

当最大化 Emacs 框架时,框架会扩展以填充两个显示器的宽度以及较大显示器的高度。

显然,我希望框架最大化以仅填充其所在的显示器。 如何使用 elisp 检测两个单独显示器的分辨率?

谢谢, Jacob

编辑:正如 Denis 指出的,设置 mf-max-width 是一个合理的解决方法。 但是(正如我应该提到的)我希望有一个适用于两台显示器和任何分辨率的解决方案。 也许是 OSX 特定的东西,采用 Windows 特定的 w32-send-sys-command 的风格。

I use maxframe.el to maximize my Emacs frames.

It works great on all three major platforms, except on my dual-head Mac setup (Macbook Pro 15-inch laptop with 23-inch monitor).

When maximizing an Emacs frame, the frame expands to fill the width of both monitors and the height of the larger monitor.

Obviously, I would like the frame to maximize to fill only the monitor it's on. How can I detect the resolutions of the two individual monitors using elisp?

Thanks,
Jacob

EDIT: As Denis points out, setting mf-max-width is a reasonable workaround. But (as I should have mentioned) I was hoping for a solution that works on both monitors and with any resolution. Maybe something OSX-specific in the style of the Windows-specific w32-send-sys-command.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

趁微风不噪 2024-07-12 02:33:19

我快速浏览了您提供给 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))))))

I quickly scanned the reference that you provided to maxframe.el and I don't think that you're using the same technique that I use. Does the following code snippet help you?


(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))))))
凡尘雨 2024-07-12 02:33:19

自定义“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."

Does customising `mf-max-width' work? Its documentation:

"*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."
橪书 2024-07-12 02:33:19

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

This sort of thing is the job of your window manager, not the job of emacs. (For example, Xmonad handles full-screen emacs just fine.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文