Commits (3)
......@@ -960,7 +960,9 @@ It indents by four spaces and is otherwise similar to the BSD style.")
(use-package ftblog
:commands ftblog/new-entry ftblog/meta-insert)
(use-package ft-gui :config (ft/initialise-gui))
(use-package ft-gui
:map ("<f12>" ft/update-frame-parameters)
:config (ft/initialise-gui))
(use-package ft-space-key
......@@ -62,18 +62,18 @@ The parameter set can be retrieved by functions like
(ft/monitor-to-pixel-density (frame-monitor-attributes)))
(defun ft/generate-font-string (system)
(defun ft/generate-font-string (system &optional fsize)
"Generate font string for SYSTEM to use in a `font' spec.
It takes into account the system that is running emacs and the
pixel density of the dominating monitor that the focused emacs
frame is visible on."
(format (ft/font-format system)
(ft/density-to-font-size (ft/pixel-density))))
(or fsize (ft/density-to-font-size (ft/pixel-density)))))
(defun ft/frame-parameters (system)
(defun ft/frame-parameters (system &optional fsize)
"Return frame parameter alist for SYSTEM."
(cons (cons 'font (ft/generate-font-string system))
(cons (cons 'font (ft/generate-font-string system fsize))
(defun ft/set-gui-buffer-parameters ()
......@@ -107,16 +107,20 @@ frame is visible on."
(w/variable make-pointer-invisible
(setq make-pointer-invisible t)))
(defun ft/update-frame-parameters ()
(defun ft/update-frame-parameters (font-size)
"Modify current frame's parameters according to system and monitor."
(modify-frame-parameters nil (ft/frame-parameters (ft/host-system))))
(interactive "P")
(when (called-interactively-p 'interactive)
(message "Updating frame parameters"))
(let ((params (ft/frame-parameters (ft/host-system) font-size)))
(modify-frame-parameters nil params)
(defun ft/frame-creation-hook ()
"ft-gui function to hook into `server-after-make-frame-hook'."
(ft/update-frame-parameters nil)
(winring-set-name "default"))
(defun ft/initialise-gui ()