kkga / nibar

Simple Übersicht status bar with yabai support.
MIT License
192 stars 33 forks source link

Unknow script output #1

Closed ThomasF34 closed 4 years ago

ThomasF34 commented 4 years ago

Hi,

I just installed your widget and in the desktop infos (on the left) i have an error : Error : unknown script output

image

I looked at both primary and secondary spaces scripts and ran them manually. Primary printed a correct result but secondary did not, saying it could not locate the given display.

In spaces-secondary.sh I replaced this line by :

SPACES=$(yabai -m query --spaces --display)

But i still have the same error. Do you know what's causing this ?

Thanks

shagia commented 4 years ago

Went through this because I'm super interested myself, it looks like you require jq to pass-through the parsed JSON data.

Install Homebrew if you haven't and brew install jq, after that you'd probably want to remove spaces-secondary.jsx from the active folder if you aren't using a secondary monitor, and give spaces-primary.jsx a refreshFrequency relative towards what won't drain your battery.

kkga commented 4 years ago

Primary printed a correct result but secondary did not, saying it could not locate the given display.

The "spaces-secondary" widget prints out workspaces from a secondary connected monitor. If you don't have one, it will print out an error, so you should just disabled it from the uebersicht menu.

kkga commented 4 years ago

and give spaces-primary.jsx a refreshFrequency relative towards what won't drain your battery.

Alternatively, use yabai's signals to trigger refreshing specific uebersicht widgets. I've just added more info on that in the README: https://github.com/kkga/nibar#usage

rublev commented 4 years ago

and give spaces-primary.jsx a refreshFrequency relative towards what won't drain your battery.

Alternatively, use yabai's signals to trigger refreshing specific uebersicht widgets. I've just added more info on that in the README: https://github.com/kkga/nibar#usage

This no longer works for whatever reason. I got the bar working with spaces by changing the refreshrate but adding the yabai spaces-changed signal isn't working.

See my comments in https://github.com/koekeishiya/yabai/issues/381

None of these work:

# ubersicht="$(ps ax | grep sicht | awk '{print $5}' | head -1 | cut -d/ -f3 | cut     -d. -f1)"
# echo $ubersicht
# refresh primary display workspaces
# yabai -m signal --add event='space_changed' action="ru"

# refresh my Übersicht bar when the space changes
# yabai -m signal --add event='space_changed' \
#     action="osascript -e 'tell application \"'$(ps ax | grep sicht | awk '{print $5}' | head -1 | cut -d/ -f3 | cut -d. -f1)'\" to refresh'"

# yabai -m signal --add event=space_changed action="osascript -e 'display notification \"active space changed.\" with title \"yabai\" subtitle \"signal\"'"
# yabai -m signal --add event=space_changed action="osascript -e 'tell application $(ps ax | grep sicht | awk '{print $5}' | head -1 | cut -d/ -f3 | cut -d. -f1) to refresh'"
# refresh primary display workspaces
# yabai -m signal --add event=space_changed \
#     action="osascript -e 'tell application \"Übersicht\" to refresh widget id \"nibar-spaces-primary-jsx\"'"

# yabai -m notification trigger=space-changed \
    # action="osascript -e 'tell application \"Übersicht\" to refresh widget id \"yabai-space-widget\"'"
# yabai -m signal --add event=space_changed action="osascript -e 'display notification \"active space changed.\" with title \"yabai\" subtitle \"signal\"'"
kkga commented 4 years ago

here's what I have in .yabairc:

yabai -m signal --add event=space_changed \
    action="osascript -e 'tell application \"Übersicht\" to refresh widget id \"nibar-spaces-primary-jsx\"'"
yabai -m signal --add event=window_focused \
    action="osascript -e 'tell application \"Übersicht\" to refresh widget id \"nibar-spaces-primary-jsx\"'"
yabai -m signal --add event=space_changed \
    action="osascript -e 'tell application \"Übersicht\" to refresh widget id \"nibar-spaces-secondary-jsx\"'"
yabai -m signal --add event=window_focused \
    action="osascript -e 'tell application \"Übersicht\" to refresh widget id \"nibar-spaces-secondary-jsx\"'"

It works perfectly in my case.


What do you see when running 👇 this command directly in a terminal?

osascript -e 'tell application "Übersicht" to refresh widget id "nibar-spaces-primary-jsx"'
rublev commented 4 years ago

here's what I have in .yabairc:

yabai -m signal --add event=space_changed \
    action="osascript -e 'tell application \"Übersicht\" to refresh widget id \"nibar-spaces-primary-jsx\"'"
yabai -m signal --add event=window_focused \
    action="osascript -e 'tell application \"Übersicht\" to refresh widget id \"nibar-spaces-primary-jsx\"'"
yabai -m signal --add event=space_changed \
    action="osascript -e 'tell application \"Übersicht\" to refresh widget id \"nibar-spaces-secondary-jsx\"'"
yabai -m signal --add event=window_focused \
    action="osascript -e 'tell application \"Übersicht\" to refresh widget id \"nibar-spaces-secondary-jsx\"'"

It works perfectly in my case.

* yabai-v2.2.2

* Übersicht 1.4 (61)

What do you see when running 👇 this command directly in a terminal?

osascript -e 'tell application "Übersicht" to refresh widget id "nibar-spaces-primary-jsx"'

Hey thanks for the quick reply! I get:

$ osascript -e 'tell application "Übersicht" to refresh widget id "nibar-spaces-primary-jsx"'
32:46: syntax error: A identifier can’t go after this identifier. (-2740)
$ osascript -e 'tell application \"Übersicht\" to refresh widget id "nibar-spaces-primary-jsx"'
17:18: syntax error: Expected expression, property or key form, etc. but found unknown token. (-2741)
rublev@andreis-MacBook-Pro ~ %

I tried the commands you listed as well and changed refreshRate to false in the JSX file but it didn't work.