Is there a way to run certain commands (from init.el) only when I am in GUI mode and not in terminal mode. I want to set a certain color scheme when I run the GUI version, but that scheme screws up the terminal window's colors pretty badly. I'm looking for some variable/function which would look something like this:
(if gui-mode (color-scheme-blah))
or:
(unless terminal-mode (color-scheme-blah))
You want something like
(if window-system (color-scheme-blah))
window-system
can be 'x
or 'mswindows
or possibly even other values, but it's always nil
when you are on a terminal.
To generally test for a graphic display you want to use the following:
(display-graphic-p &optional DISPLAY)
It returns non-nil if DISPLAY is a graphic display. Using for example the window-system
variable also works, but requires you to refer to a specific environment (such as X or Microsoft Windows).
When using emacsclient and frames GUI or terminal mode is not necessarily a global concept. See the very useful answer to my question at https://superuser.com/questions/165335/how-can-i-show-the-emacs-menu-in-gui-emacs-frames-but-not-in-tty-frames-when-usin .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With