diff --git a/README.md b/README.md index c36f1ca..1579c45 100644 --- a/README.md +++ b/README.md @@ -399,6 +399,7 @@ link preview from them. ./interzone -no-mouse # leave the mouse to the terminal ./interzone -layout compact # phone layout, whatever the size (or wide, or auto) ./interzone -theme nord # colours for one run (ctrl+y switches and remembers them) +INTERZONE_MOTION=off ./interzone # keep the logo and progress bars still ./interzone -plain # no colours, ASCII boxes and bars, no animation: for screen # readers and logs (or INTERZONE_PLAIN=1) ``` diff --git a/internal/ui/anim.go b/internal/ui/anim.go index d6e68d9..646ba5c 100644 --- a/internal/ui/anim.go +++ b/internal/ui/anim.go @@ -2,6 +2,7 @@ package ui import ( "math" + "os" "strings" "time" @@ -14,8 +15,9 @@ import ( // // A few things move: Welcome's logo flows through the theme's colours and // the deploy bar shimmers while it runs. Frames tick only while the screen -// showing asks for them, and never in plain mode. Frame 0 is the still -// picture, which the layout tests draw. +// showing asks for them, and never in plain mode or with +// INTERZONE_MOTION=off (for slow links, and screenshots that don't depend on +// the moment). Frame 0 is the still picture, which the layout tests draw. var animFrame int @@ -30,7 +32,7 @@ type animator interface{ animating() bool } // is on its way already. func (a *App) animate() tea.Cmd { an, ok := a.cur().(animator) - if a.animOn || plain || !ok || !an.animating() { + if a.animOn || plain || !ok || !an.animating() || os.Getenv("INTERZONE_MOTION") == "off" { return nil } a.animOn = true diff --git a/internal/ui/anim_test.go b/internal/ui/anim_test.go index 9182a5e..6d38dd1 100644 --- a/internal/ui/anim_test.go +++ b/internal/ui/anim_test.go @@ -18,6 +18,11 @@ func TestAnimTicksOnlyWhereSomethingMoves(t *testing.T) { t.Error("a second tick while one is on its way") } a.animOn = false + t.Setenv("INTERZONE_MOTION", "off") + if a.animate() != nil { + t.Error("INTERZONE_MOTION=off still ticks") + } + t.Setenv("INTERZONE_MOTION", "") a.step = a.index("Manage") if a.animate() != nil { t.Error("Manage doesn't move, yet it ticks") diff --git a/scripts/screenshots/shots.sh b/scripts/screenshots/shots.sh index 4955b9f..2c716ca 100755 --- a/scripts/screenshots/shots.sh +++ b/scripts/screenshots/shots.sh @@ -54,7 +54,7 @@ start() { JSON tmux kill-session -t shot 2>/dev/null || true tmux new-session -d -s shot -x "${size%x*}" -y "${size#*x}" -c "$work" \ - "env -u XDG_CONFIG_HOME XDG_CONFIG_HOME=rel XDG_DATA_HOME='~/.local/share' INTERZONE_HEALTH=off COLORTERM=truecolor ./iz 2>iz.err" + "env -u XDG_CONFIG_HOME XDG_CONFIG_HOME=rel XDG_DATA_HOME='~/.local/share' INTERZONE_HEALTH=off INTERZONE_MOTION=off COLORTERM=truecolor ./iz 2>iz.err" echo "running in tmux session shot ($size); attach with: tmux attach -t shot" }