agzam / spacehammer

Hammerspoon config inspired by Spacemacs
MIT License
556 stars 70 forks source link

toggle app stopped working properly 🥲 #173

Closed butterywombat closed 1 year ago

butterywombat commented 1 year ago

Hello! I previously got your help making a toggler fn work: https://github.com/agzam/spacehammer/issues/52 it's generally been working out very well even if there's some hiccups with the rest of the setup! However suddenly it now only seems to let me toggle it on and off once, before I need to click/change focus to something else before toggling can happen again. Any ideas why? I'm guessing that means it thinks the app is still 'frontmost' so it doesn't 'unhide'? Any help would be greatly appreciated as I use this literally all the times. It just suddenly stopped working (I think). Thanks!

here's my log if that helps:


2023-01-10 17:33:41: -- Lazy extension loading enabled
2023-01-10 17:33:41: -- Loading ~/.hammerspoon/init.lua
2023-01-10 17:33:41: -- Loading extension: alert
2023-01-10 17:33:42: -- Loading extension: ipc
2023-01-10 17:33:42: -- Loading extension: fnutils
2023-01-10 17:33:42: -- Loading extension: logger
2023-01-10 17:33:42: -- Loading extension: hints
2023-01-10 17:33:42: -- Loading extension: window
2023-01-10 17:33:42: -- Loading extension: pathwatcher
2023-01-10 17:33:42: -- Loading extension: hotkey
2023-01-10 17:33:42: 17:33:42     hotkey: Enabled hotkey ⌘⌃`
2023-01-10 17:33:42: -- Loading extension: drawing
2023-01-10 17:33:42: -- Loading extension: console
2023-01-10 17:33:42:              hotkey: Enabled hotkey F18
2023-01-10 17:33:42: -- Loading extension: screen
2023-01-10 17:33:42: -- Loading extension: grid
2023-01-10 17:33:42: -- Loading extensions: window.switcher
2023-01-10 17:33:42: -- Loading extensions: window.filter
2023-01-10 17:33:42:              hotkey: Enabled hotkey ⌘K
2023-01-10 17:33:42:              hotkey: Enabled hotkey ⌘SPACE
2023-01-10 17:33:42:              hotkey: Enabled hotkey ⌘N
2023-01-10 17:33:42:              hotkey: Enabled hotkey ⌘⌃P
2023-01-10 17:33:42:              hotkey: Disabled previous hotkey ⌘⌃`
2023-01-10 17:33:42:              hotkey: Enabled hotkey ⌘⌃`
2023-01-10 17:33:42: -- Loading extension: application
2023-01-10 17:33:42: -- Loading extension: base64
2023-01-10 17:33:42:            apps.fnl:     app is now: nil
2023-01-10 17:33:42: -- Done.
2023-01-10 17:33:43: -- Some applications have alternate names which can also be checked if you enable Spotlight support with `hs.application.enableSpotlightForNameSearches(true)`.
2023-01-10 17:33:44: 17:33:44                 app is now: nil
2023-01-10 17:33:44:                          app is now: nil
2023-01-10 17:33:45: 17:33:45                 app is now: nil
2023-01-10 17:33:45:                          app is now: nil
2023-01-10 17:33:58: -- Loading extension: inspect
2023-01-10 17:33:58: 17:33:58  modal.fnl:     {}
2023-01-10 17:34:01: 17:34:01                 {}
2023-01-10 17:34:01:              hotkey: Deleted hotkey SPACE
2023-01-10 17:34:01:              hotkey: Deleted hotkey L
2023-01-10 17:34:01:              hotkey: Deleted hotkey W
2023-01-10 17:34:01:              hotkey: Deleted hotkey J
2023-01-10 17:34:01:              hotkey: Deleted hotkey M
2023-01-10 17:34:01:              hotkey: Deleted hotkey ESCAPE
2023-01-10 17:34:01:              hotkey: Deleted hotkey ⌃[
2023-01-10 17:34:01:           modal.fnl:     {}
2023-01-10 17:34:04: 17:34:04                 {}
2023-01-10 17:34:04:              hotkey: Deleted hotkey SPACE
2023-01-10 17:34:04:              hotkey: Deleted hotkey L
2023-01-10 17:34:04:              hotkey: Deleted hotkey W
2023-01-10 17:34:04:              hotkey: Deleted hotkey J
2023-01-10 17:34:04:              hotkey: Deleted hotkey M
2023-01-10 17:34:04:              hotkey: Deleted hotkey ESCAPE
2023-01-10 17:34:04:              hotkey: Deleted hotkey ⌃[
2023-01-10 17:34:06: 17:34:06  modal.fnl:     {}
2023-01-10 17:34:07: 17:34:07                 {}
2023-01-10 17:34:07:              hotkey: Deleted hotkey SPACE
2023-01-10 17:34:07:              hotkey: Deleted hotkey L
2023-01-10 17:34:07:              hotkey: Deleted hotkey W
2023-01-10 17:34:07:              hotkey: Deleted hotkey J
2023-01-10 17:34:07:              hotkey: Deleted hotkey M
2023-01-10 17:34:07:              hotkey: Deleted hotkey ESCAPE
2023-01-10 17:34:07:              hotkey: Deleted hotkey ⌃[
2023-01-10 17:34:07: -- Loading extension: timer
2023-01-10 17:34:08: 17:34:08   apps.fnl:     app is now: nil
2023-01-10 17:34:08:                          app is now: nil
2023-01-10 17:34:09: 17:34:09  modal.fnl:     {}
2023-01-10 17:34:10: 17:34:10                 {}
2023-01-10 17:34:10:              hotkey: Deleted hotkey SPACE
2023-01-10 17:34:10:              hotkey: Deleted hotkey L
2023-01-10 17:34:10:              hotkey: Deleted hotkey W
2023-01-10 17:34:10:              hotkey: Deleted hotkey J
2023-01-10 17:34:10:              hotkey: Deleted hotkey M
2023-01-10 17:34:10:              hotkey: Deleted hotkey ESCAPE
2023-01-10 17:34:10:              hotkey: Deleted hotkey ⌃[
2023-01-10 17:34:10:            apps.fnl:     app is now: nil
2023-01-10 17:34:10:                          app is now: nil
2023-01-10 17:34:15: 17:34:15  modal.fnl:     {}
2023-01-10 17:34:19: 17:34:19                 {}
2023-01-10 17:34:19:              hotkey: Deleted hotkey SPACE
2023-01-10 17:34:19:              hotkey: Deleted hotkey L
2023-01-10 17:34:19:              hotkey: Deleted hotkey W
2023-01-10 17:34:19:              hotkey: Deleted hotkey J
2023-01-10 17:34:19:              hotkey: Deleted hotkey M
2023-01-10 17:34:19:              hotkey: Deleted hotkey ESCAPE
2023-01-10 17:34:19:              hotkey: Deleted hotkey ⌃[
2023-01-10 17:34:22: 17:34:22  modal.fnl:     {}
2023-01-10 17:34:24: 17:34:24                 {}
2023-01-10 17:34:24:              hotkey: Deleted hotkey SPACE
2023-01-10 17:34:24:              hotkey: Deleted hotkey L
2023-01-10 17:34:24:              hotkey: Deleted hotkey W
2023-01-10 17:34:24:              hotkey: Deleted hotkey J
2023-01-10 17:34:24:              hotkey: Deleted hotkey M
2023-01-10 17:34:24:              hotkey: Deleted hotkey ESCAPE
2023-01-10 17:34:24:              hotkey: Deleted hotkey ⌃[
2023-01-10 17:35:09: 17:35:09   apps.fnl:     app is now: nil
2023-01-10 17:35:09:                          app is now: nil
2023-01-10 17:35:10: 17:35:10                 app is now: nil
2023-01-10 17:35:10:                          app is now: nil
2023-01-10 17:35:17: 17:35:17                 app is now: nil
2023-01-10 17:35:17:                          app is now: nil
2023-01-10 17:35:17:                          app is now: nil
2023-01-10 17:35:17:                          app is now: nil
2023-01-10 17:35:31: 17:35:31                 app is now: nil
2023-01-10 17:35:31:                          app is now: nil
2023-01-10 17:36:28: 17:36:28                 app is now: nil
2023-01-10 17:36:28:                          app is now: nil
2023-01-10 17:37:32: 17:37:32                 app is now: nil
2023-01-10 17:37:32:                          app is now: nil
2023-01-10 17:39:04: 17:39:04                 app is now: nil
2023-01-10 17:39:04:                          app is now: nil
2023-01-10 17:39:09: 17:39:09                 app is now: nil
2023-01-10 17:39:09:                          app is now: nil
2023-01-10 17:39:12: 17:39:12                 app is now: nil
2023-01-10 17:39:12:                          app is now: nil
2023-01-10 17:39:17: 17:39:17                 app is now: nil
2023-01-10 17:39:17:                          app is now: nil
2023-01-10 17:39:53: 17:39:53                 app is now: nil
2023-01-10 17:39:53:                          app is now: nil
2023-01-10 17:39:59: 17:39:59                 app is now: nil
2023-01-10 17:39:59:                          app is now: nil
2023-01-10 17:40:05: 17:40:05                 app is now: nil
2023-01-10 17:40:05:                          app is now: nil
2023-01-10 17:40:56: 17:40:56                 app is now: nil
2023-01-10 17:40:56:                          app is now: nil
2023-01-10 17:42:49: 17:42:49                 app is now: nil
2023-01-10 17:42:49:                          app is now: nil
2023-01-10 17:42:52: 17:42:52                 app is now: nil
2023-01-10 17:42:52:                          app is now: nil
2023-01-10 17:43:26: 17:43:26                 app is now: nil
2023-01-10 17:43:26:                          app is now: nil
2023-01-10 17:43:30: 17:43:30                 app is now: nil
2023-01-10 17:43:30:                          app is now: nil
2023-01-10 17:43:39: 17:43:39                 app is now: Hammerspoon
2023-01-10 17:43:39:                          app is now: Hammerspoon
2023-01-10 17:43:40: 17:43:40                 app is now: nil
2023-01-10 17:43:40:                          app is now: nil
2023-01-10 17:43:46: 17:43:46                 app is now: nil
2023-01-10 17:43:46:                          app is now: nil
2023-01-10 17:43:47: 17:43:47                 app is now: nil
2023-01-10 17:43:47:                          app is now: nil
2023-01-10 17:43:51: 17:43:51                 app is now: nil
2023-01-10 17:43:51:                          app is now: nil
2023-01-10 17:43:54: 17:43:54                 app is now: Hammerspoon
2023-01-10 17:43:54:                          app is now: Hammerspoon
jaidetree commented 1 year ago

When's the last time you restarted Hammerspoon? I've noticed Hammerspoon tends to degrade over time unless restarted once in a while.

Could you please post an example of your config with the current toggler implementation? I can try it myself and see if I can reproduce.

One thought is that it could be modified to just update a table at runtime with each app that's toggled. This would remove the need to rely on isFrontmostApp.

butterywombat commented 1 year ago

I tried restarting hammerspoon and also some reloads of the config but it didn't help. my config: https://raw.githubusercontent.com/butterywombat/dotfileserino/master/stows/dot-spacehammer/config.fnl thanks!

butterywombat commented 1 year ago

hmm the issue seems to have resolved after some computer restarts. No idea...I spose I will close it for now unless you see anything I should change!