Is There a Way to Determine the State of Window Animations via a Shell Script?

I understand how to run a shell script to toggle window animations via KM.

defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool YES/NO

Is there a way to determine the current state of the Window Animation bool?

THE GOAL:

I'd like to turn the animations off for some KM macros and then return them to the previous state with an if/then statement

Hello @MikeMcC

I would do the following:

Create a global Variable named DND__AutomaticWindowAnimationsEnabled with the Value TRUE or FALSE depending on the current state.

Then create a Macro that uses this state as a condition to enable/disable the State and set the Variable to the opposite.

TRUE => Disable + FALSE
FALSE => Enable + TRUE

I hope this helps …

Greetings from Germany

Tobias

Thanks!

But my question is - how would I determine the current state?

As I am aware of there is no defaults command for determining the state - but if you know the command and what it does you can help yourself like the way I described it in my first reply.

Since you say you can change it using defaults write..., try defaults read... to read it.

1 Like

Yup! this is it!

defaults read NSGlobalDomain NSAutomaticWindowAnimationsEnabled

returns a variable of 0 or 1 depending on the state

Thanks @Nige_S - learned something new while drinking my first morning coffee and appended my note in Quiver with that defaults read command instantly

@MikeMcC - I would combine this new command with the approach I posted yesterday with an enhancement of receiving input - which will give you the ability to run it as submacro whenever you want to

This is just an idea you can benefit from - since my time is currently over I can not give you the macro today … but maybe you have enough input for now to create it yourself.

Let us know how it’s going

Greetings from Germany

Tobias