Check availability of yabai #761
-
What is the method with the least overhead to query if yabai is running? Currently I fire a timer with this args:
I guess it's not optimal? PID and Socket can be leftovers when eg WindowManager crashed, can't they? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
The socket and pid file can indeed be leftovers from a previous session. I’m not sure what the fastest command to run would be, but I’d probably just run: yabai -m config window_shadow Most commands take similar amount of time to run when it fails to open a connection to the socket because yabai is not running, however this command requires less processing from yabai in cases where it is running (and gets a response). The command above returns the current value of the shadow_setting and you can just discard the response as you already do with the query command in your sample. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the reply, I tried it: time yabai -m query --displays 0.01s user 0.00s system 49% cpu 0.019 total Seems to be the better solution. I will adapt my code. |
Beta Was this translation helpful? Give feedback.
The socket and pid file can indeed be leftovers from a previous session. I’m not sure what the fastest command to run would be, but I’d probably just run:
yabai -m config window_shadow
Most commands take similar amount of time to run when it fails to open a connection to the socket because yabai is not running, however this command requires less processing from yabai in cases where it is running (and gets a response). The command above returns the current value of the shadow_setting and you can just discard the response as you already do with the query command in your sample.