Skip to content

Instantly share code, notes, and snippets.

@agzam
Last active August 28, 2020 02:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agzam/7733edf9629c7b10e7c8a8711198a3f2 to your computer and use it in GitHub Desktop.
Save agzam/7733edf9629c7b10e7c8a8711198a3f2 to your computer and use it in GitHub Desktop.
Emacs undecorated (title-less) frame in OSX
(defun toggle-frame-maximized-undecorated ()
(interactive)
(let* ((frame (selected-frame))
(on? (and (frame-parameter frame 'undecorated)
(eq (frame-parameter frame 'fullscreen) 'maximized)))
(geom (frame-monitor-attribute 'geometry))
(x (nth 0 geom))
(y (nth 1 geom))
(display-height (nth 3 geom))
(display-width (nth 2 geom))
(cut (if on?
(if ns-auto-hide-menu-bar 26 50)
(if ns-auto-hide-menu-bar 4 26))))
(set-frame-position frame x y)
(set-frame-parameter frame 'fullscreen-restore 'maximized)
(set-frame-parameter nil 'fullscreen 'maximized)
(set-frame-parameter frame 'undecorated (not on?))
(set-frame-height frame (- display-height cut) nil t)
(set-frame-width frame (- display-width 20) nil t)
(set-frame-position frame x y)))
@jdelStrother
Copy link

Where are the first and second functions defined?

@agzam
Copy link
Author

agzam commented Aug 18, 2020

first and second are aliases for car and cadr,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment