all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* get current frame size?
@ 2015-10-12 11:51 Sivaram Neelakantan
  2015-10-12 13:04 ` Michael Heerdegen
  0 siblings, 1 reply; 3+ messages in thread
From: Sivaram Neelakantan @ 2015-10-12 11:51 UTC (permalink / raw)
  To: help-gnu-emacs


I end up working with different monitors and each time I end up doing
a trail and error method to get the right frame size for Emacs that
covers the width of the screen and 80% of the height.  Note that I
don't want a fullscreen mode which I can invoke from the command
line.  Is there a way to query the current frame to return the
dimensions so that I can plug it in my .Emacs?

Something like

(if (window-system) (set-frame-size (selected-frame) 124 40))

where the last 2 numbers seem to change for laptop screen


 sivaram
 -- 




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: get current frame size?
  2015-10-12 11:51 get current frame size? Sivaram Neelakantan
@ 2015-10-12 13:04 ` Michael Heerdegen
  2015-10-12 13:24   ` Drew Adams
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Heerdegen @ 2015-10-12 13:04 UTC (permalink / raw)
  To: help-gnu-emacs

Sivaram Neelakantan <nsivaram.net@gmail.com> writes:

> I end up working with different monitors and each time I end up doing
> a trail and error method to get the right frame size for Emacs that
> covers the width of the screen and 80% of the height.  Note that I
> don't want a fullscreen mode which I can invoke from the command
> line.  Is there a way to query the current frame to return the
> dimensions so that I can plug it in my .Emacs?
>
> Something like
>
> (if (window-system) (set-frame-size (selected-frame) 124 40))
>
> where the last 2 numbers seem to change for laptop screen

See (info "(elisp) Size Parameters").  But maybe consider doing it
dynamically:

 - Note that the fullscreen frame parameter can also be used to maximize
 a frame horizontally or vertically.

 - You can also calculate the frame parameters at run time using
 `display-pixel-width', `display-pixel-width'.  But I don't think Emacs
 knows the sizes of window borders and title bar, so the approach is
 somewhat limited.  At least can you use the above functions to test on
 which kind of screen you "are".

 - Drew Adam's "frame-cmds.el" has additional related stuff.


Michael.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: get current frame size?
  2015-10-12 13:04 ` Michael Heerdegen
@ 2015-10-12 13:24   ` Drew Adams
  0 siblings, 0 replies; 3+ messages in thread
From: Drew Adams @ 2015-10-12 13:24 UTC (permalink / raw)
  To: Michael Heerdegen, help-gnu-emacs

>  - You can also calculate the frame parameters at run time using
>  `display-pixel-width', `display-pixel-width'.  But I don't think
>  Emacs knows the sizes of window borders and title bar, so the approach
>  is somewhat limited.  At least can you use the above functions to test
>  on which kind of screen you "are".
> 
>  - Drew Adam's "frame-cmds.el" has additional related stuff.

See also the code in `oneonone.el'.  It uses `(x-display-pixel-width)'
(and `...-height'), called `display-pixel-width' in recent Emacs (both
names work).



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-10-12 13:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-12 11:51 get current frame size? Sivaram Neelakantan
2015-10-12 13:04 ` Michael Heerdegen
2015-10-12 13:24   ` Drew Adams

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.