Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Executing shell script with command not working #381

Closed
rublev opened this issue Jan 22, 2020 · 4 comments
Closed

Executing shell script with command not working #381

rublev opened this issue Jan 22, 2020 · 4 comments
Labels
question Request for information or help, not an issue

Comments

@rublev
Copy link

rublev commented Jan 22, 2020

first attempt (not working)

ubersicht="$(ps ax | grep sicht | awk '{print $5}' | head -1 | cut -d/ -f3 | cut     -d. -f1)"
alt - x: osascript -e 'tell application "'"$ubersicht"'" to refresh'

second attempt (not working)
refresh-ubersicht.sh (chmod +x)

#!/usr/bin/env bash

set -e

ubersicht="$(ps ax | grep sicht | awk '{print $5}' | head -1 | cut -d/ -f3 | cut     -d. -f1)"
echo $ubersicht
osascript -e 'tell application "'"$ubersicht"'" to refresh'

command 1 (not working): alt - x : '/Users/username/.dotfiles/yabai/refresh-ubersicht.sh'
command 2 (not working): alt - x : '~/.dotfiles/yabai/refresh-ubersicht.sh'
command 3 (not working): alt - x : /Users/username/.dotfiles/yabai/refresh-ubersicht.sh
command 4 (not working): alt - x : ~/.dotfiles/yabai/refresh-ubersicht.sh

zsh alias (working)

# refresh ubersicht pecan style
ubersicht="$(ps ax | grep sicht | awk '{print $5}' | head -1 | cut -d/ -f3 | cut -d. -f1)"
# alias ru="osascript -e 'tell application \"'$(ps ax | grep sicht | awk '{print $5}' | head -1 | cut -d/ -f3 | cut -d. -f1)'\" to refresh'"
alias ru="osascript -e 'tell application \"'$ubersicht'\" to refresh'"
@dominiklohmann
Copy link
Collaborator

This really isn't an issue with yabai.

Did you consider looking at the stdout / stderr of the parent process to see why and where this fails?

Side note: If your script is named "refresh-ubersicht", then ps ax | grep sicht will also catch the script itself. Use something like pgrep -x instead (see man 1 pgrep).

@rublev
Copy link
Author

rublev commented Jan 22, 2020

This really isn't an issue with yabai.

Did you consider looking at the stdout / stderr of the parent process to see why and where this fails?

don't know enough about system stuff to even know what stdout or stderr is, will look into it.

Side note: If your script is named "refresh-ubersicht", then ps ax | grep sicht will also catch the script itself. Use something like pgrep -x instead (see man 1 pgrep).

how? its a shell script not an actively running app.

@rublev
Copy link
Author

rublev commented Jan 22, 2020

This really isn't an issue with yabai.

Did you consider looking at the stdout / stderr of the parent process to see why and where this fails?

Side note: If your script is named "refresh-ubersicht", then ps ax | grep sicht will also catch the script itself. Use something like pgrep -x instead (see man 1 pgrep).

what am I doing wrong with syntactically?

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'"`  

trying to get the following working:

# 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\"'"

@dominiklohmann
Copy link
Collaborator

I suggest reading up on how to refresh individual Übersicht widgets using AppleScript, and discussing further in the repository for the bar you're using.

There is no concise question in this thread about yabai, and it looks like the troubles you're having are not related to yabai either.

@koekeishiya koekeishiya added the question Request for information or help, not an issue label Jan 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Request for information or help, not an issue
Projects
None yet
Development

No branches or pull requests

3 participants