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

command using jq works when running from command line but not as a service #348

Open
amuricys opened this issue Apr 15, 2024 · 1 comment

Comments

@amuricys
Copy link

skhd-v0.3.9
yabai-v7.1.0

command in question

# create desktop, move window and follow focus - uses jq for parsing json
lshift + lcmd - n : yabai -m space --create && \
        index="$(yabai -m query --spaces --display | ~/.nix-profile/bin/jq 'map(select(."is-native-fullscreen" == false))[-1].index')" && \
        yabai -m window --space "${index}" && \
        yabai -m space --focus "${index}"

if I run skhd from a terminal, this command works correctly. but if I run skhd --start-service, it simply does not. I don't know where to look for logs either.

Note that if I comment out the index variable and set a literal index, like so:

lshift + lcmd - n : yabai -m space --create && \
        yabai -m window --space "5" && \
        yabai -m space --focus "5"

it works (assuming i only have 4 spaces)

@MunsMan
Copy link

MunsMan commented May 11, 2024

It appears that the jq command is currently installed only in your user space and not system-wide. This could cause issues if you're trying to access it from processes that don't operate within your user environment, such as a daemon managed by launchd.

If you're using nix-darwin, I recommend installing jq system-wide by adding it to the environment.systemPackages in your Nix configuration. This will ensure it's available globally on your system.

Alternatively, if you prefer using Homebrew, you can install jq globally with the following command:

brew install jq

Please note that the path ~/.nix-profile/bin/jq is a dynamic symlink and might not be accessible to the skhd daemon when it's controlled by launchd, as these processes typically have different visibility into the file system than your user processes.

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

3 participants
@amuricys @MunsMan and others