simple-bar
simple-bar copied to clipboard
JSON error in simple-bar-spaces (Performance issue)
Sometimes, the spaces widget only shows "simple-bar-spaces.jsx: JSON error...". Going to another virtual desktop and going back fixes the issue.
I can't tell what exactly triggers that issue, but I'm not doing anything special (dis/connecting monitors, closing/opening the lid, etc.)

JSON example:
{ "spaces": { "spaces": [{ "id":3, "label":"", "index":1, "display":1, "windows":[1877, 1876], "type":"bsp", "visible":0, "focused":0, "native-fullscreen":0, "first-window":1876, "last-window":1877 },{ "id":4, "label":"", "index":2, "display":1, "windows":[1824, 887], "type":"bsp", "visible":1, "focused":1, "native-fullscreen":0, "first-window":1824, "last-window":1824 },{ "id":5, "label":"", "index":3, "display":1, "windows":[], "type":"bsp", "visible":0, "focused":0, "native-fullscreen":0, "first-window":0, "last-window":0 },{ "id":6, "label":"", "index":4, "display":1, "windows":[], "type":"bsp", "visible":0, "focused":0, "native-fullscreen":0, "first-window":0, "last-window":0 },{ "id":7, "label":"", "index":5, "display":1, "windows":[], "type":"bsp", "visible":0, "focused":0, "native-fullscreen":0, "first-window":0, "last-window":0 },{ "id":13, "label":"", "index":6, "display":2, "windows":[157, 120, 182], "type":"bsp", "visible":1, "focused":0, "native-fullscreen":0, "first-window":157, "last-window":120 },{ "id":9, "label":"", "index":7, "display":2, "windows":[], "type":"bsp", "visible":0, "focused":0, "native-fullscreen":0, "first-window":0, "last-window":0 },{ "id":10, "label":"", "index":8, "display":2, "windows":[], "type":"bsp", "visible":0, "focused":0, "native-fullscreen":0, "first-window":0, "last-window":0 },{ "id":11, "label":"", "index":9, "display":2, "windows":[], "type":"bsp", "visible":0, "focused":0, "native-fullscreen":0, "first-window":0, "last-window":0 },{ "id":12, "label":"", "index":10, "display":2, "windows":[], "type":"bsp", "visible":0, "focused":0, "native-fullscreen":0, "first-window":0, "last-window":0 }], "windows": }, "displays": [{ "id":1, "uuid":"37D8832A-2D66-02CA-B9F7-8F30A301B230", "index":1, "spaces":[1, 2, 3, 4, 5], "frame":{ "x":0.0000, "y":0.0000, "w":1680.0000, "h":1050.0000 } },{ "id":2, "uuid":"1F4B9C65-9486-EA53-0857-D6964E3302DB", "index":2, "spaces":[6, 7, 8, 9, 10], "frame":{ "x":1680.0000, "y":-246.0000, "w":2304.0000, "h":1296.0000 } }], "SIP": "System Integrity Protection status: enabled." }
Opening this file in Sublime Text instantly highlights the error:

In a second JSON error I had (pasted here but some strings have been redacted for privacy), the error is actually different:
{ "spaces": { "spaces": [{ "id":3, "label":"", "index":1, "display":1, "windows":[1877, 1876], "type":"bsp", "visible":0, "focused":0, "native-fullscreen":0, "first-window":1876, "last-window":1877 },{ "id":4, "label":"", "index":2, "display":1, "windows":[1824, 887], "type":"bsp", "visible":1, "focused":0, "native-fullscreen":0, "first-window":1824, "last-window":1824 },{ "id":5, "label":"", "index":3, "display":1, "windows":[], "type":"bsp", "visible":0, "focused":0, "native-fullscreen":0, "first-window":0, "last-window":0 },{ "id":6, "label":"", "index":4, "display":1, "windows":[], "type":"bsp", "visible":0, "focused":0, "native-fullscreen":0, "first-window":0, "last-window":0 },{ "id":7, "label":"", "index":5, "display":1, "windows":[], "type":"bsp", "visible":0, "focused":0, "native-fullscreen":0, "first-window":0, "last-window":0 },{ "id":13, "label":"", "index":6, "display":2, "windows":[157, 120, 182], "type":"bsp", "visible":1, "focused":1, "native-fullscreen":0, "first-window":157, "last-window":120 },{ "id":9, "label":"", "index":7, "display":2, "windows":[], "type":"bsp", "visible":0, "focused":0, "native-fullscreen":0, "first-window":0, "last-window":0 },{ "id":10, "label":"", "index":8, "display":2, "windows":[], "type":"bsp", "visible":0, "focused":0, "native-fullscreen":0, "first-window":0, "last-window":0 },{ "id":11, "label":"", "index":9, "display":2, "windows":[], "type":"bsp", "visible":0, "focused":0, "native-fullscreen":0, "first-window":0, "last-window":0 },{ "id":12, "label":"", "index":10, "display":2, "windows":[], "type":"bsp", "visible":0, "focused":0, "native-fullscreen":0, "first-window":0, "last-window":0 }], "windows": [{ "id":1877, "pid":564, "app":"Finder", "title":"REDACTED", "frame":{ "x":848.0000, "y":44.0000, "w":820.0000, "h":994.0000 }, "level":0, "role":"AXWindow", "subrole":"AXStandardWindow", "movable":1, "resizable":1, "display":1, "space":1, "visible":0, "focused":0, "split":"vertical", "floating":0, "sticky":0, "minimized":0, "topmost":0, "opacity":1.0000, "shadow":1, "border":0, "stack-index":0, "zoom-parent":0, "zoom-fullscreen":0, "native-fullscreen":0 },{ "id":1876, "pid":564, "app":"Finder", "title":"REDACTED", "frame":{ "x":12.0000, "y":44.0000, "w":820.0000, "h":994.0000 }, "level":0, "role":"AXWindow", "subrole":"AXStandardWindow", "movable":1, "resizable":1, "display":1, "space":1, "visible":0, "focused":0, "split":"vertical", "floating":0, "sticky":0, "minimized":0, "topmost":0, "opacity":1.0000, "shadow":1, "border":0, "stack-index":0, "zoom-parent":0, "zoom-fullscreen":0, "native-fullscreen":0 },{ "id":1824, "pid":543, "app":"Safari", "title":"REDACTED", "frame":{ "x":12.0000, "y":44.0000, "w":1656.0000, "h":994.0000 }, "level":0, "role":"AXWindow", "subrole":"AXStandardWindow", "movable":1, "resizable":1, "display":1, "space":2, "visible":1, "focused":0, "split":"none", "floating":0, "sticky":0, "minimized":0, "topmost":0, "opacity":1.0000, "shadow":1, "border":0, "stack-index":0, "zoom-parent":0, "zoom-fullscreen":0, "native-fullscreen":0 },{ "id":887, "pid":553, "app":"REDACTED", "title":"REDACTED", "frame":{ "x":6.0000, "y":6.0000, "w":1677.0000, "h":498.0000 }, "level":0, "role":"AXWindow", "subrole":"AXDialog", "movable":1, "resizable":1, "display":1, "space":2, "visible":0, "focused":0, "split":"none", "floating":1, "sticky":0, "minimized":1, "topmost":0, "opacity":1.0000, "shadow":1, "border":0, "stack-index":0, "zoom-parent":0, "zoom-fullscreen":0, "native-fullscreen":0 },{ "id":157, "pid":544, "app":"REDACTED", "title":"REDACTED", "frame":{ "x":1692.0000, "y":-202.0000, "w":397.0000, "h":1240.0000 }, "level":0, "role":"AXWindow", "subrole":"AXStandardWindow", "movable":1, "resizable":1, "display":2, "space":6, "visible":1, "focused":1, "split":"vertical", "floating":0, "sticky":0, "minimized":0, "topmost":0, "opacity":1.0000, "shadow":1, "border":0, "stack-index":0, "zoom-parent":0, "zoom-fullscreen":0, "native-fullscreen":0 },{ "id":120, "pid":529, "app":"REDACTED", "title":"REDACTED", "frame":{ "x":3046.0000, "y":-202.0000, "w":925.0000, "h":1240.0000 }, "level":0, "role":"AXWindow", "subrole":"AXStandardWindow", "movable":1, "resizable":1, "display":2, "space":6, "visible":1, "focused":0, "split":"vertical", "floating":0, "sticky":0, "minimized":0, "topmost":0, "opacity":1.0000, "shadow":1, "border":0, "stack-index":0, "zoom-parent":0, "zoom-fullscreen":0, "native-fullscreen":0 },{ "id":182, "pid":547, "app":"Mail", "title":"REDACTED", "frame":{ "x":2105.0000, "y":-202.0000, "w":925.0000, "h":1240.0000 }, "level":0, "role":"AXWindow", "subrole":"AXStandardWindow", "movable":1, "resizable":1, "display":2, "space":6, "visible":1, "focused":0, "split":"vertical", "floating":0, "sticky":0, "minimized":0, "topmost":0, "opacity":1.0000, "shadow":1, "border":0, "stack-index":0, "zoom-parent":0, "zoom-fullscreen":0, "native-fullscreen":0 }] }, "displays": , "SIP": "System Integrity Protection status: enabled." }


In both cases, I guess the solution would be to replace these empty values with something like {}
or []
, even though it seems weird that in some circumstances, no display is recognized.
[EDIT] Another error, something slightly different:

Hi! I was also observing this behaviour and I just committed a fix that should resolve this issue.
It seems that this issue is a bit random and is caused by yabai not returning data in some instances. Since the issue disappear on workspace change when the spaces widget is refreshed, I am now automatically refreshing if there is an error in the json.
Let me know if this is better now. :)
Thanks for reporting this.
Thank you for your work 🚀
I'll be in holidays in France this week, so I don't think I'll be able to give a quick feedback. I'll do my best to reach back to you ASAP if I notice improvements or different errors!
After a few days of daily use, I did not notice this error again.
Thank you for the fix! It seems to work perfectly :D
Reopening the issue: the exact same errors are still appearing unfortunately.
Looks like a yabai issue: koekeishiya/yabai#600
Every time this error happens, it disappears within a second. The workaround is great.
I'd doubt it's a yabai issue, because this never appeared before "27 days ago"
But usability-wise, the workaround fits perfectly. So this issue is still a bug, but probably on a lowest priority!
Yes I couldn’t find another way so I'll close this for now!
I think this issue should be re-opened @Jean-Tinland
The issue is still happening, and has been slowing down yabai since.
Reverting to 0184337c
makes that issue go away, BUT it also makes yabai way more snappier.
Reverting to 58c0d601
makes the issue re-appear, and yabai is noticeably slower on my machine (for example, yabai -m query --windows
sometimes takes 2 seconds)
This slowdown is not happening if simple-bar is disabled / if Übersicht is closed, and it's also not happening on simple-bar @ 0184337c
There's a chance simple-bar is doing yabai requests infinitely (e.g. from a signal)
This is weird, there is no changes related to yabai signals in both this commits.
simple-bar is setting its own signals in init.sh
. Each signal has a label so it can't be set twice.
Are you sure there isn't some signal set in your .yabairc
?
You can add this line in your .yabairc
in order to restart Übersicht on yabai restart:
osascript -e 'tell application id "tracesOf.Uebersicht" to refresh'
It might not be related to yabai signals! I'm only speculating at this point
I did not look into this for now, but there is the chance either simple-bar is repetitively calling yabai commands, thus slowing yabai down, or simple-bar is maybe calling a yabai command as a result of a signal, which would trigger another signal, which would trigger again the yabai command...
I don't have any signal set in my .yabairc
I'm not sure what the change is between these 2 commits, but that JSON error is a symptom of some regression that appeared at some point.
Hard to tell what is causing this, I'll try to monitor everything and hopefully solve this issue! Thank you for your inputs!
Sorry I'm triyng to look at it as well but I'm not quite sure what would cause it 😔
The slowdowns are actually more noticeable when a second monitor is plugged in, if that matters!
This problem haunted me for a long time and sometimes caused the simple bar and yabai to freeze. I just what to share that this problem seems to disappear (at least less frequent for me) when I disable all widgets except time/date/battery.
Therefore it seems that it is not related to yabai, but the widgets.