Function: hycontrol-frame-percentage-of-screen
hycontrol-frame-percentage-of-screen is an interactive and
byte-compiled function defined in hycontrol.el.
Signature
(hycontrol-frame-percentage-of-screen PERCENT &optional DIMENSION)
Documentation
Resize the selected frame to be approximately PERCENT of the screen.
PERCENT may be given as a decimal percentage or a number between 0 and 100. Optional DIMENSION if given must be either of the symbols, height or width to affect only that dimension.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hycontrol.el
(defun hycontrol-frame-percentage-of-screen (percent &optional dimension)
"Resize the selected frame to be approximately PERCENT of the screen.
PERCENT may be given as a decimal percentage or a number between 0 and 100.
Optional DIMENSION if given must be either of the symbols, height or
width to affect only that dimension."
(interactive "nResize frame to be this percent of the screen (1-100): ")
(if (and (numberp percent)
(progn
;; Normalize to a fractional percentage
(when (> percent 1)
(setq percent (/ percent 100.0)))
(setq percent (max (min (float percent) 0.998) 0.0))
(> percent 0.0)))
(let ((frame-resize-pixelwise t)
max-height
max-width)
(cond ((eq dimension 'height)
(set-frame-height
nil (min (floor (* (setq max-height (- (display-pixel-height) hycontrol-screen-top-offset hycontrol-screen-bottom-offset))
percent))
max-height)
nil t))
((eq dimension 'width)
(set-frame-width
nil (min (floor (* (setq max-width (- (display-pixel-width)
(* 2.5 (frame-scroll-bar-width))
hycontrol-screen-left-offset hycontrol-screen-right-offset))
percent))
max-width)
nil t))
(t (set-frame-size
nil (min (floor (* (setq max-width (- (display-pixel-width)
(* 2.5 (frame-scroll-bar-width))
hycontrol-screen-left-offset hycontrol-screen-right-offset))
percent))
max-width)
(min (floor (* (setq max-height (- (display-pixel-height) hycontrol-screen-top-offset hycontrol-screen-bottom-offset))
percent))
max-height)
t)))
;; If resize has caused right or bottom edge to move
;; offscreen, align these edges to the edge of the screen
;; (moving the frame).
(when (> (+ (hycontrol-frame-x-origin) (hycontrol-frame-width))
(- (display-pixel-width) hycontrol-screen-right-offset))
(hycontrol-frame-to-right))
(when (> (+ (hycontrol-frame-y-origin) (hycontrol-frame-height))
(- (display-pixel-height) hycontrol-screen-bottom-offset))
(hycontrol-frame-to-bottom))
;; Return the scaled percentage for setting as numeric argument.
(floor (* percent 100)))
(error "(hycontrol-frame-fraction-of-screen): `%s', must be a percent value above 0 and less than or equal to 100" percent)))