This is my first attempt to customize my spacemacs. Bare with me, I just looked at some elisp examples the last few hours and came up with this:
;; Change font-size based on screen resolution (setq crappy-projector-theme-loaded nil) (defun fontify-frame () (cond ((> (x-display-pixel-width) 2600) (text-scale-set 0)) ;; docked ((< (x-display-pixel-width) 1100) (progn (text-scale-set 2) (load-theme 'spacemacs-light t) (setq crappy-projector-theme-loaded t) )) ;; crappy projector (t (progn (text-scale-set 1.2) (if (equal crappy-projector-theme-loaded t) (progn (load-theme 'spacemacs-dark t) (setq crappy-projector-theme-loaded nil) ) ) )) ) ) (add-hook 'window-configuration-change-hook 'fontify-frame)
What I need from emacs:
At university, there are some occations where I need to present some code in front of the class. There is always the problem with bad (I mean, really bad) projectors in our classrooms. You can't really see something when you project something with black background and white font. It's since a habit to switch to another theme in whatever editor you're using and tremendesly increase the size of the font used. It's crappy as hell, and I don't want to spend too much thought with wit.
With the little function above I'll catch more than one circumstances, when changing textsize is handy: In the university as soon as a projector is connected, and at home where I dock my notebook and use a ultrawide 32" display. At home, the display is large - and most of the time it's there where I sit and work. This should be my basis. At the university, most of the projectors are pretty old, and only support 800x600px or 1024x768px. That's my second environment to switch textsize and in this case the theme too. The default case is when I'm on the way and when I'm using the notebook display - it's resolution is right in between the other cases.
If the display resolution is above 2600px -> Ultrawide Display at home
If the display resolution is below 1100px -> a crappy projector is used
If none of the above is the case, I'm probably using the built in display of the notebook.
So far, this function works. Maybe I built in some errors, but usually thats the fault of elisp. It's the first time I used it myself, and I don't think we will be friends any time soon...