48

I reduced animation and transition in macOS but not completely disabled

As some people already discussed, one can "reduce motion" in accessibility settings, use defaults write to "disable" some animations, or use software like TinkerTool. But after all of that, when I switch desktops using Ctrl + Left or Ctrl + Right, macOS still displays a "fade in, fade out" animation for a few deciseconds, which is fine. But

the window focus remains messed up for a while.

Either the window on the previous desktop is still focused, or no windows are focused, for about 1 second, and I cannot perform any operation, which is super annoying and slows down my workflow.

A workaround

is to use Cmd + Tab to switch apps, or use Ctrl + 1-9 to jump to a specific desktop. In this way, the window focus is corrected. But this is a workaround, not a solution.

Modification I did

  • Every setting in TinkerTool.app that disables animation
  • "Reduce motion" in macOS accessibility settings
  • Some scripts, the one related to this is
defaults write com.apple.dock expose-animation-duration -float 0.1

previous discussion about this

How can I disable animation when switching desktops in Lion? talked about posting a bug and TotalSpaces.
How do you completely disable the space-switching animations in OS X Yosemite? concluded that there's no solution.
Disabling desktop switching animation on El Capitan. Solution has same problem as I have.
How can I disable animation when switching desktops in El Capitan? talked about TotalSpaces and disabling SIP.

Tetsujin
  • 115,663
Steven He
  • 813
  • 1
  • 6
  • 9
  • Can you provide a video of what you mean by "the window focus is messed up"? In my experience, moving to a new desktop takes about the same time as pressing a key (e.g. CTRL right arrow), or the swiping motion on the trackpad, and the windows in the new space are immediately in focus and present. Also, what OS and what model Mac; any external monitors? I'd suggest testing the speed in a brand new user account, and see if that's better. Alternatively, don't use Spaces: just switch between application windows in the same Desktop space. – benwiggy Jan 04 '22 at 10:19
  • 7
    I am using Mac Pro M1, and regardless of whether I use a trackpad gesture or a shortcut, the animation lasts for around a second and the previous window is active during this time. This is extremely annoying. – Mikhail Jun 29 '22 at 08:29
  • Interestingly enough, when I plug an external monitor and make it main, the animation becomes faster! Maybe this setting is related to displays. – Mikhail Jun 30 '22 at 14:13
  • I've been looking for a solution to this problem for a year now. The only thing that somewhat worked for me was Hammerspoon with spaces: https://github.com/asmagill/hs._asm.undocumented.spaces but that got patched a while ago. There is currently no good solution other than switching to Arch and i3. – EuxhenH Jul 04 '22 at 17:17
  • I know this is just another workaround but ... if you have just single instance of an app fullscreen on another workspace, and you just alt+tab to it, the animation is MUCH faster. I have minimized all windows except one fullscreen on separate desktop and alt+tab to it is nice. – Rustem Mustafin Oct 30 '23 at 08:29
  • The "focus is messed up" in the sense that the previous window keeps the cursor focus the whole time until the animation is completed, which apparently is more than a second. So that way I'm able to switch from my editor to the terminal in another space, start typing "git status" or whatever, getting really annoyed that the terminal somehow only registered "t status". And then later unless I'm very vigilant, I might commit a file with a stray "gi" added somewhere causing the build to break. The cursor focus SHOULD MOVE FIRST in a sensible OS, but it doesnt! – Stein G. Strindhaug Dec 14 '23 at 11:26

2 Answers2

16

yabai + keymaps

You can use yabai to manage your windows on macos and remove all animations. The yabai commands that allow you to move instantly between 'spaces' are

yabai -m space --focus prev        # move left
yabai -m space --focus next        # move right

The only other thing you will need is a program to remap the keyboard inputs. I prefer Karabiner-Elements because it gives you the most fine tuned control in my experience. But it is more for people comfortable with computer programming.

Some easier (uses a GUI) but paid options are Keyboard Maestro and BetterTouchTool. With these options you would remap Ctrl and Ctrl to these system/shell/bash commands.

karabiner

If you want to go the karabiner/coding route this should get you started.

You can use Karabiner-Elements to remap Ctrl and Ctrl to these commands. If you are new to Karabiner I suggest using goku to create your karabiner configuration.

I think this configuration for the karabiner.edn file (goku/karabiner config) would work

{
    :templates {
        :yabai-focus-space    "/usr/local/bin/yabai -m space --focus \"%s\""
    }
    :main [
      {
        :des "Yabai - Focus prev/next"
        :rules [
            [:!Tleft_arrow [:yabai-focus-space "prev"]]
            [:!Tleft_arrow [:yabai-focus-space "next"]]
        ]}
    ]
}
Jav
  • 103
5

I know this question has already been answered and been accepted but I just wanted to share some of my findings about this topic. The problem I faced with the accepted answer was that with Mission Control => Displays have separate spaces set, the above behavior did not work like native macOS and instead cycled through the spaces without respecting which monitor that space is on. If you are reading this, that means this problem really pisses you off so... here is my solution.

My machine - Macbook Pro 16" Intel 2019 macOS Monterey But solution should work on M series Macbooks as well as long as yabai runs fine.

Problem

macOS spaces change animation when done via keyboard shortcuts ctrl+right/left is very slow and it feels quite annoying because it also greatly reduces the time to focus. There is no native way to get rid of this delayed animation.

Solution

We can use a tool called Yabai in conjunction with a tool like Better Touch Tool to fix this problem with the following steps.

Config

My /Users/akay64/.yabairc file contents, I don't need any other configs from Yabai or the tiling window manager so my config file is bare bones.

#!/usr/bin/env sh

for this to work you must configure sudo such that

it will be able to run the command without password

see this wiki page for information:

- https://github.com/koekeishiya/yabai/wiki/Installing-yabai-(latest-release)#configure-scripting-addition

yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa" sudo yabai --load-sa

Scripting

Now go to Better Touch Tool and create a new keyboard shortcut for moving to the left space, pick action "Execute terminal command (Async)" and have it run this script.

/usr/local/bin/yabai -m space --focus $(/usr/local/bin/yabai -m query --spaces --display mouse | /Users/akay64/standalone/jq ".[].index" | grep $((`/usr/local/bin/yabai -m query --spaces --space mouse | /Users/akay64/standalone/jq ".index"` - 1)))

enter image description here

Now do the same for moving to the right space and give it this script to run

/usr/local/bin/yabai -m space --focus $(/usr/local/bin/yabai -m query --spaces --display mouse | /Users/akay64/standalone/jq ".[].index" | grep $((1 + `/usr/local/bin/yabai -m query --spaces --space mouse | /Users/akay64/standalone/jq ".index"`)))

enter image description here

At this point this keyboard short cut can be bound to any other input tool, in my case I prefer to bind it to my mouse buttons.

enter image description here

What is this script doing?

  1. Gets all the spaces of the current display under your mouse cursor
  2. Gets the index of the current space under your mouse cursor
  3. Finds the +1 or -1 (next or previous) space indexes for the current display
  4. Passes the found index to the space --focus command to move focus to

This approach allows us to replicate the default macOS behavior (sans the animation) of only being able to change the space of the monitor your mouse it currently at rather than cycling through all the spaces regardless of the monitor.