spacehammer icon indicating copy to clipboard operation
spacehammer copied to clipboard

Slow loading of window behaviors

Open jaidetree opened this issue 6 years ago • 1 comments

Reproduction

  1. Press cmd-space j or cmd-space w cmd+j

Expected

The command should run immediately and the alert window should close immediately

Actual

Those commands take a moment to fire and the alert window lingers for a second or two.

jaidetree avatar Sep 06 '19 20:09 jaidetree

This was reported by a friend trying out the develop branch.

There's a couple of smaller issues wrapped up in this. The performance issues should be fixable and are likely caused by how I'm lazy loading a menu item action. For instance windows:jump would require the windows module and call the jump function. We may be able to cache that better so we can avoid re-reloading modules.

The other part, where the alert window lingers was intended. Actions can be marked as repeatable. Let's say you want to jump 3 windows to the right, you can press:

cmd+space w cmd+l cmd+l cmd+l

When an action is repeatable it sets a timer to wait for repeated keypresses from the currently open menu. When the timer fires, we close the menu and disable the hotkey modal.

To improve this, multiple ideas come to mind:

  1. Display an animated progress bar representing the repeating timer. The vim module has an example of drawing a box at a specific size at a specific placement on the screen.
  2. Hide the modal when an action is triggered but key the hotkey modal active for the duration of the timer. This is significantly easier than option #1 but may lead to confusing behavior on more complicated configs.
  3. Remove the repeatable: true from the default actions. The easiest option of the 3. It may make the menu behave more as expected but then people may miss that feature.

jaidetree avatar Sep 06 '19 20:09 jaidetree

This was fixed with updating the fsm library. May have also been caused by a build up of log data that slows Hammerspoon down. That was patched upstream.

jaidetree avatar Apr 21 '23 05:04 jaidetree