[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Snippet to programmatically cycle through frame size
From: |
Pankaj Jangid |
Subject: |
Snippet to programmatically cycle through frame size |
Date: |
Mon, 07 Dec 2020 10:42:25 +0530 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin) |
Inspired by two threads on the mailing-list:
1) Cycle Auto-fill
2) Programmatically maximize Emacs during startup?
I have written this code snippet to cycle through default, small and big
frame sizes. The definitions are arbitrarily hard-coded. Need to fix
those. My monitor is at 2560x1440 pixel resolution. You should change
the values as per your context if you use this snippet.
Key binding is set to M-<f9>.
M-<f10> is already bound to toggle-frame-maximized
<f11> is assigned to toggle-frame-fullscreen (On macOS this is used by
the OS so I have changed it to M-<f11>
So I have a three key-bidings M-<f9>, M-<f10>, M-<f11>.
--8<---------------cut here---------------start------------->8---
(defvar looks--frame-size 0)
(defun looks-cycle-frame-size ()
"Cycle frame-size among default, small and big.
0) default - 80x38 (built-in).
1) small - 100x48
2) big - 174x58"
(interactive)
(pcase looks--frame-size
(0 (set-frame-size (next-frame) 100 48)
(setq looks--frame-size 1))
(1 (set-frame-size (next-frame) 174 58)
(setq looks--frame-size 2))
(2 (set-frame-size (next-frame) 80 38)
(setq looks--frame-size 0))))
(global-set-key (kbd "M-<f9>") 'looks-cycle-frame-size)
--8<---------------cut here---------------end--------------->8---
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Snippet to programmatically cycle through frame size,
Pankaj Jangid <=