The Computer Oracle

How to make emacs truly full screen on start up?

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Dreamlands

--

Chapters
00:00 How To Make Emacs Truly Full Screen On Start Up?
00:38 Accepted Answer Score 8
01:25 Answer 2 Score 3
02:00 Answer 3 Score 3
02:16 Answer 4 Score 2
02:41 Answer 5 Score 1
02:58 Thank you

--

Full question
https://superuser.com/questions/294395/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#ubuntu #emacs #kubuntu

#avk47



ACCEPTED ANSWER

Score 8


I've taken this from somewhere on emacswiki, some time ago. Note that I no longer use it, as I've switched to dwm to have everything fullscreen, but it used to work.

(defun fullscreen ()
       (interactive)
       (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
                 '(2 "_NET_WM_STATE_FULLSCREEN" 0)))

If you want it to run on startup, you should be able to add

(fullscreen)

to your .emacs

EDIT: Rereading your question, I think this is not what you want. This will go really fullscreen, not maximized: you will not have any close button.

This one should do:

(defun fullscreen (&optional f)
  (interactive)
  (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
             '(2 "_NET_WM_STATE_MAXIMIZED_VERT" 0))
  (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
             '(2 "_NET_WM_STATE_MAXIMIZED_HORZ" 0)))

Now it's directly from http://www.emacswiki.org/emacs/FullScreen




ANSWER 2

Score 3


Here are two non-Lisp ways to achieve the same:

  1. Alias your emacs command to emacs -fs. Add this line of code to your .bashrc file in your home directory:

    alias emacs='emacs -fs'
    

    Personally, I don't like this approach because I wouldn't want Emacs to start up in full screen all the time and would like some control.

  2. My solution: In Ubuntu, you can assign a keyboard shortcut to 'full-screen' any window. This seems to be the most convenient and simple option. Besides, it has the advantage that the same shortcut also applies to all your applications.




ANSWER 3

Score 3


Put (w32-send-sys-command ?\xf030) on your .emacs file. I think it solves your problem.

(works on Windows only)




ANSWER 4

Score 2


If you would like to toggle fullscreen in emacs with the F11 key, add the following to .emacs:

;; the following should give fullscreen mode when F11 is depressed
(defun fullscreen ()
 (interactive)
 (set-frame-parameter nil 'fullscreen
              (if (frame-parameter nil 'fullscreen) nil 'fullboth))

If you want the fullscreen emacs to be very minimal (no tool bar, scroll bar, or menu bar, also add:

(progn
  (if (fboundp 'tool-bar-mode) (tool-bar-mode -1))  ;; no toolbar
  (menu-bar-mode -1) ;;no menubar
  (scroll-bar-mode -1) ;; no scroll bar
  )
)



ANSWER 5

Score 1


I currently use Emacs version 28.2 on Windows, and a minimal solution is adding the line below to the Emacs configuration at ~/.emacs.d/init.el (different under unix)

(set-frame-parameter nil 'fullscreen 'fullboth)