Commit 953eca30 authored by Frank Terbeck's avatar Frank Terbeck

Make gui configuration setup more robust

When starting console clients before GUI ones, a couple of settings might not
have been setup properly before. This should take care of these issues better.
Increases font size on very large laptop displays even more. Maybe it would be
better to check against DPI.
parent 2edf883a
......@@ -145,46 +145,69 @@
(cond ((> width 1400) 11)
(t 11)))
((eq system 'x-win)
(cond ((> width 2500) 13)
(cond ((> width 2500) 14)
((> width 1400) 11)
(t 10)))
(t 12))))
(concat (format fmt size)
(if embolden-p ":embolden=true" ""))))
(defvar ft/gui-initialised nil
"Session variable reflecting if emacs' GUI parameters were initialised yet.")
(defmacro w/variable (name &rest code)
`(when (boundp (quote ,name))
,@code))
(defmacro w/function (name &rest code)
`(when (fboundp (quote ,name))
,@code))
(defun ft/set-gui-parameters ()
;; Configure GUI font based on system and screen size.
(let ((system (ft/host-system)))
;; Configure GUI font based on system and screen size.
(when (memq system '(x-win ms-win))
(setq default-frame-alist
(let* ((width (ft/gui-display-width))
(height (ft/gui-display-height))
(gui-font (ft/generate-font-string system width height)))
(list (cons 'horizontal-scroll-bars nil)
(cons 'vertical-scroll-bars nil)
(cons 'font gui-font)))))
;; Put yanked stuff into primary buffer, if we're on X11 since this will
;; not work on M$-Windoze type systems — and terminal emacs doesn't give
;; a crap anyway.
(when (eq system 'x-win)
(setq select-enable-primary t)
(setq select-enable-clipboard nil)
(setq x-select-enable-clipboard-manager nil)))
;; Mouse behaviour adjustments.
(when (display-mouse-p)
;; Mouse avoidance mode is interesting, but I only liked the ‘banish’ mode it
;; offers. Now after a while, I sometimes misclicked in another application
;; after switching to another workspace in my window manager.
(mouse-avoidance-mode 'none)
;; This is the default, but I wanted to remind myself that it exists.
;; Unfortuntely, it only makes the pointer invisible after *changing* a
;; buffer, and *not* if you merely move the cursor or scroll a buffer's
;; display. This is rather annoying for reading documentation within emacs.
;; Not great, but oh well.
(setq make-pointer-invisible t)))
(defvar ft/gui-initialised-p nil
"Session variable reflecting if emacs' GUI parameters were initialised yet.")
(unless (member system ft/gui-initialised)
(when (member system '(x-win ms-win))
(w/variable default-frame-alist
(setq default-frame-alist
(let* ((width (ft/gui-display-width))
(height (ft/gui-display-height))
(gui-font (ft/generate-font-string system
width
height)))
(list (cons 'horizontal-scroll-bars nil)
(cons 'vertical-scroll-bars nil)
(cons 'font gui-font))))
(modify-frame-parameters nil default-frame-alist)))
;; Put yanked stuff into primary buffer, if we're on X11 since this will
;; not work on M$-Windoze type systems — and terminal emacs doesn't give
;; a crap anyway.
(w/variable select-enable-primary
(setq select-enable-primary t))
(w/variable select-enable-clipboard
(setq select-enable-clipboard nil))
(w/variable x-select-enable-clipboard-manager
(setq x-select-enable-clipboard-manager nil))
;; Mouse avoidance mode is interesting, but I only liked the ‘banish’ mode it
;; offers. Now after a while, I sometimes misclicked in another application
;; after switching to another workspace in my window manager.
(w/function mouse-avoidance-mode
(mouse-avoidance-mode 'none))
;; This is the default, but I wanted to remind myself that it exists.
;; Unfortuntely, it only makes the pointer invisible after *changing* a
;; buffer, and *not* if you merely move the cursor or scroll a buffer's
;; display. This is rather annoying for reading documentation within emacs.
;; Not great, but oh well.
;;
;; Update: There's https://github.com/jcs/xbanish which does pretty much
;; exactly what I want. Not in debian though... ...should I?
(w/variable make-pointer-invisible
(setq make-pointer-invisible t))
(setq ft/gui-initialised (cons system ft/gui-initialised)))))
(when (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
(when (fboundp 'menu-bar-mode) (menu-bar-mode -1))
......@@ -192,10 +215,7 @@
(add-hook 'server-after-make-frame-hook
(lambda ()
(unless ft/gui-initialised-p
(ft/set-gui-parameters)
(modify-frame-parameters nil default-frame-alist)
(setq ft/gui-initialised-p t))
(ft/set-gui-parameters)
(winring-set-name "default")))
(setq-default line-spacing 0.1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment