Is it possible to check from within an elisp function if the current emacs frame is an X window or a terminal?
I have a function that maximizes the window, and it’s set to run whenever a new frame is created. However, when I open a terminal-only session I get error messages whenever a new frame is created.
I want the function to check whether it is an X window, and do nothing otherwise. Is that possible?
For the record, here is the current function:
(defun fullscreen (&optional f)
(interactive) ;if called interactively, use current frame
(if f (select-frame f)) ;if called as hook, use new frame
(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))
)
You may look at the
window-systemfunction. It accepts a frame optional argument (defaults to current frame). Alternatively,display-graphic-pis more recent (as per the documentation) and allows checking a whole display containing several frames. In your example, you could just write: