emacs-diffs
[Top][All Lists]
Advanced

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

master e313cae71f: Add helper function to remove title bar when maximizi


From: Lars Ingebrigtsen
Subject: master e313cae71f: Add helper function to remove title bar when maximizing frames
Date: Fri, 29 Apr 2022 06:42:20 -0400 (EDT)

branch: master
commit e313cae71fc38e29849e68b421a16a1014626d04
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Add helper function to remove title bar when maximizing frames
    
    * lisp/frame.el (toggle-frame-maximized): Mention it.
    (frame-hide-title-bar-when-maximized): New function (bug#31968).
    Adapted from code by Jonathan Kyle Mitchell.
    
    * src/window.c (syms_of_window): Mention it.
---
 lisp/frame.el | 13 +++++++++++++
 src/window.c  |  5 ++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/lisp/frame.el b/lisp/frame.el
index 83e67dac4e..49eabcf978 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -2960,6 +2960,12 @@ If the frame is in fullscreen state, don't change its 
state, but
 set the frame's `fullscreen-restore' parameter to `maximized', so
 the frame will be maximized after disabling fullscreen state.
 
+If you wish to hide the title bar when the frame is maximized, you
+can add something like the following to your init file:
+
+  (add-hook \\='window-size-change-functions
+            #\\='frame-hide-title-bar-when-maximized)
+
 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.  In addition, you may have to set
@@ -3075,6 +3081,13 @@ Offer NUMBER as default value, if it is a natural 
number."
         bidi-display-reordering
         bidi-inhibit-bpa))
 
+(defun frame-hide-title-bar-when-maximized (frame)
+  "Hide the title bar if FRAME is maximized.
+If FRAME isn't maximized, show the title bar."
+  (set-frame-parameter
+   frame 'undecorated
+   (eq (alist-get 'fullscreen (frame-parameters frame)) 'maximized)))
+
 (provide 'frame)
 
 ;;; frame.el ends here
diff --git a/src/window.c b/src/window.c
index 48da783931..ad0f54000c 100644
--- a/src/window.c
+++ b/src/window.c
@@ -8341,7 +8341,10 @@ In this case the window is passed as argument.
 Functions specified by the default value are called for each frame if
 at least one window on that frame has been added or changed its buffer
 or its total or body size since the last redisplay.  In this case the
-frame is passed as argument.  */);
+frame is passed as argument.
+
+For instance, to hide the title bar when the frame is maximized, you
+can add `frame-hide-title-bar-when-maximized' to this variable.  */);
   Vwindow_size_change_functions = Qnil;
 
   DEFVAR_LISP ("window-selection-change-functions", 
Vwindow_selection_change_functions,



reply via email to

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