Function Repository Resource:

NotebookOnScreenQ

Source Notebook

Test whether an open notebook is fully displayed on a screen

Contributed by: Bradley Ashby

ResourceFunction["NotebookOnScreenQ"][]

gives True if the EvaluationNotebook[] is fully displayed on a single screen and False otherwise.

ResourceFunction["NotebookOnScreenQ"][nb]

gives True if nb is fully displayed on a single screen and False otherwise.

Details

Will return False if nb is split across multiple screens.
ResourceFunction["NotebookOnScreenQ"] is not affected by the Visible setting for notebooks.

Examples

Basic Examples (2) 

Test whether this notebook is fully displayed on screen:

In[1]:=
ResourceFunction["NotebookOnScreenQ"][]
Out[1]=

Move the notebook slightly off screen and check again:

In[2]:=
SetOptions[EvaluationNotebook[], WindowMargins -> {{-1, Automatic}, {Automatic, -1}}];
ResourceFunction["NotebookOnScreenQ"][]
Out[3]=

Scope (1) 

Test whether a notebook is on screen using its NotebookObject:

In[4]:=
ResourceFunction["NotebookOnScreenQ"][
NotebookObject[
 "67c9fe5b-4b1e-487e-8eb4-3aa2cfd76418", "d64ed67e-b4ee-43cb-b427-47ea4699a94b"]]
Out[4]=

Publisher

Bradley Ashby

Version History

  • 1.0.0 – 03 October 2022

Related Resources

Author Notes

I also want to support a usage that can take the values of WindowMargins and WindowSize as arguments, so you can test whether they will result in a visible notebook before you set those values. Sounds like work, though.

License Information