diff options
-rw-r--r-- | configs/rcs/emacs.d/init.el | 70 |
1 files changed, 10 insertions, 60 deletions
diff --git a/configs/rcs/emacs.d/init.el b/configs/rcs/emacs.d/init.el index a9249e6..b6749a8 100644 --- a/configs/rcs/emacs.d/init.el +++ b/configs/rcs/emacs.d/init.el @@ -101,11 +101,19 @@ '(inhibit-startup-message t) '(inhibit-startup-echo-area-message t)) +(use-package frame + :ensure nil + :bind (("C-c C-m" . toggle-frame-fullscreen)) + :config + ;; when using darwin I don't want to use the native full screen mode, as it opens a new work space + (when (eq system-type 'darwin) + (setq ns-use-native-fullscreen nil)) + (set-face-attribute 'default nil :height 150 :weight 'normal :width 'normal)) + (use-package general :config (general-define-key - "M-j" 'join-line - "C-c m m" 'emacs-toggle-size)) + "M-j" 'join-line)) ;;; emacs hygiene @@ -370,61 +378,3 @@ (use-package protobuf-mode :after (flyspell) :hook ((protobuf-mode . flyspell-prog-mode))) - -;;; layout -;; when using darwin, I don't want to use the native fullscreen mode (it opens a new workspace) -(when (eq system-type 'darwin) - (setq ns-use-native-fullscreen nil)) - -(defconst display-name - (pcase (display-pixel-width) - (`1440 'macbook-pro) - (_ 'default))) - -(defconst emacs-min-top 23) - -(defconst emacs-min-left - (pcase display-name - (`macbook-pro 140) - (`default 200))) - -(defconst emacs-min-height - (pcase display-name - (`macbook-pro 60) - (`default 47))) - -(defconst emacs-min-width - (pcase display-name - (`macbook-pro 130) - (`default 110))) - -(defconst emacs-min-font - (pcase display-name - (_ "-*-DejaVu Sans Mono-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1"))) - -(defun emacs-min () - (interactive) - (cl-flet ((set-param (p v) (set-frame-parameter (selected-frame) p v))) - (set-param 'fullscreen nil) - (set-param 'vertical-scroll-bars nil) - (set-param 'horizontal-scroll-bars nil)) - (set-frame-position (selected-frame) emacs-min-left emacs-min-top) - (set-frame-height (selected-frame) emacs-min-height) - (set-frame-width (selected-frame) emacs-min-width) - (set-frame-font emacs-min-font)) - -(defun emacs-max () - (interactive) - (cl-flet ((set-param (p v) (set-frame-parameter (selected-frame) p v))) - (set-param 'fullscreen 'fullboth) - (set-param 'vertical-scroll-bars nil) - (set-param 'horizontal-scroll-bars nil)) - (set-frame-font emacs-min-font)) - -(defun emacs-toggle-size () - (interactive) - (if (alist-get 'fullscreen (frame-parameters)) - (emacs-min) - (emacs-max))) - -(add-hook 'emacs-startup-hook #'emacs-min t) |