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

Yabai - function with arguments #232

Open
lukakemperle opened this issue Sep 30, 2023 · 2 comments
Open

Yabai - function with arguments #232

lukakemperle opened this issue Sep 30, 2023 · 2 comments

Comments

@lukakemperle
Copy link

Hi there,
I would like to execute a function (yabai) with the argument living outside the karabiner.edn:

karabiner.edn:

{:des "b-mode" :rules [ :b-sim
  [:p "~/.config/yabai/actions grid"]
]}

~/.config/yabai/actions.sh:

function float() {
  yabai -m window --toggle float
}

function grid() {
  yabai -m window --grid 3:1:1:1:1:1
}

if [ "$1" == "float" ] ; then
  float
elif [ "$1" == "grid" ] ; then
  grid
fi

# /usr/local/bin/yabai

Could please someone enlighten me on what I'm doing wrong - executing file in the terminal with arguments works (eg. ./actions.sh grid).
Thank you!

@hotsezus
Copy link

hotsezus commented Jan 4, 2024

@lukakemperle
I had the same problem until i figured out that Karabiner does not source my ~/.zshrc and so there is no yabai binary in PATH.
In order to fix it you can use full path to the location where your yabai binary lives
image

@lukakemperle
Copy link
Author

I had the same problem until i figured out that Karabiner does not source my ~/.zshrc and so there is no yabai binary in PATH.

@hotsezus, thank you for the suggestion. -I currently use yabai in the template:

:templates {
:yabai "/usr/local/bin/yabai -m %s"
}

And the call it as [:##semicolon [:yabai "display --focus east || yabai -m display --focus recent"]]

Anyway, thank you & wish you a happy and productive 2024!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants