Who took ma focus? _lsappinfo_ with the assist 0 ▲ Michael Welford 141 days ago · Tech · hide · Fediverse post For over two weeks, I found that the front application would, every hour or so, lose focus to… something. No obvious culprit made itself known, so I asked an agent to write me a script to figure it out and it came up with: #!/bin/zsh # Logs every change of the frontmost (focused) app with a timestamp. PREV="" while true; do FRONT=$(lsappinfo info -only name $(lsappinfo front) 2>/dev/null | sed 's/.*"\(.*\)".*/\1/') if [[ "$FRONT" != "$PREV" && -n "$front" ]]; then printf '%s -> %s\n' "$(date '+%H:%M:%S.%2N')" "$FRONT" | tee -a ./focus-watch.log PREV="$FRONT" fi sleep 0.15 doneTranslated into plain-english, this runs a check every 0.15 seconds, seeing if the front most application (the focused one) has changed and if so, record the newly focused app to focus-watch.log whilst printing to screen. The learning for me, lsappinfo. Running man lsappinfo reports that lsappinfo can “Control and query CoreApplicationServices about the app state on the system” and that front lists as number one… Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town