Bug introduced in 10.4 or earlier and persists through 12.1


In most cases dragging notebook's window around does not affect its WindowSize.

Why is this Dynamic triggered then?

  {RandomReal[], CurrentValue[WindowSize]}
,  TrackedSymbols :> {}

enter image description here

The problem is closely related to this one:

Notebook's WindowSize interference with contents' Dynamic ImageSizes

and looking on how it was handled by WRI I don't have high hopes for fixing it.

The question is, can this be avoided/optimized? Is this a bug, or did I miss something?

  • $\begingroup$ Do you expect the dynamic to update when changing the window's size even though you have TrackedSymbols :> {}? $\endgroup$
    – Coolwater
    Commented Jan 5, 2018 at 14:55
  • $\begingroup$ @Coolwater I'm fine with skipping this but I guess it should not harm because CurrentValue @ WindowSize or Option is not a symbol in this context. $\endgroup$
    – Kuba
    Commented Jan 5, 2018 at 15:09

3 Answers 3



Row[{Dynamic[{RandomReal[], cws}, TrackedSymbols :> {}],
  Pane[Invisible[Dynamic[cws = CurrentValue[WindowSize]]], ImageSize -> {0, 0}]}]

though maybe include cws in TrackedSymbols.

Edit by OP:

Here is the same idea implemented in a more idiomatic manner:

, DynamicWrapper[
    Dynamic[{RandomReal[], cws}]
  , FEPrivate`Set[cws, CurrentValue[WindowSize]]

Dynamic is triggered only when cws changes as opposed to having assigned (the same) value.

Additionally FEPrivate`Set and making cws a DynamicModule variable, allows us to do this part completely FronEnd side. We didn't get rid of original spam but now it does not need to waste time and links by going to kernel and back, only the main Dynamic content will need to go there.

This can be confirmed using LinkSnooper.


I'm not sure this counts as an answer; perhaps it just casts more darkness on the issue.

First your example can be reduced to

Dynamic[{RandomReal[], CurrentValue[WindowSize]}]

Second and perhaps even more annoying is

DynamicModule[{n = 0},
  Dynamic[{n++, CurrentValue[WindowSize]}, TrackedSymbols :> {}]]

which updates n when the window is moved.

My take on this is that the front-end is getting events from the OS whenever you move the window, and these events (which are probably something like or equivalent to {{left, top}, {right, bottom}} in screen coordinates) cause the front-end to recompute WindowSize for each event instance. Further, it would seem that can't be turned off by the user with TrackedSymbols :> {}, so any expression wrapped with Dynamic containing WindowSize is going to be evaluated as the window moves.

  • $\begingroup$ Yep, that unfortunately is the case :( $\endgroup$
    – Kuba
    Commented Jan 5, 2018 at 15:20

Another workaround is

Dynamic[{RandomReal[], Dynamic@CurrentValue[WindowSize]}]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.