RoboSloNE Posted April 10, 2013 Share Posted April 10, 2013 I have installed mpd and ncmpcpp, controlling it via terminal is fairly easy: ncmpcpp toggle # Toggles play/pause But when I try to make the same trick with Alfred Workflow (Trigger: Hotkey --- Action: Run Script --- Output: Post Notification) with this shell script: ncmpcpp toggle or sh /path/to/myscript.sh --------------------------------------------------- #!/bin/bash ncmpcpp toggle ...only notification pops out. Same thing happens with Automator. So, how can I control ncmpcpp via Alfred 2? Link to comment
jdfwarrior Posted April 10, 2013 Share Posted April 10, 2013 I have installed mpd and ncmpcpp, controlling it via terminal is fairly easy: ncmpcpp toggle # Toggles play/pause But when I try to make the same trick with Alfred Workflow (Trigger: Hotkey --- Action: Run Script --- Output: Post Notification) with this shell script: ncmpcpp toggle or sh /path/to/myscript.sh --------------------------------------------------- #!/bin/bash ncmpcpp toggle ...only notification pops out. Same thing happens with Automator. So, how can I control ncmpcpp via Alfred 2? Do you know where those are stored? The reason I ask is, I'm thinking this is a profile issue. By that I mean, Alfred doesn't import your user profile when running terminal commands. Therefore, certain necessary paths may not be available by default. Try providing the full path to the ncmcpp application. If it is within your home folder, use full path there as well and not ~ to represent path to your home directory. Link to comment
RoboSloNE Posted April 11, 2013 Author Share Posted April 11, 2013 I checked this, Alfred uses my user, when runs this command. And I tried to store my scripts not in home directory, still they don't work. Link to comment
jdfwarrior Posted April 11, 2013 Share Posted April 11, 2013 I checked this, Alfred uses my user I have to disagree. Alfred does not import your profile. So any additional environment variables, bash aliases etc, do not get imported. Did you try executing it with the full path to the executable? Link to comment
RoboSloNE Posted April 12, 2013 Author Share Posted April 12, 2013 Did you try executing it with the full path to the executable? Yes, I did this. And yet it doesn't work. Link to comment
jdfwarrior Posted April 12, 2013 Share Posted April 12, 2013 Yes, I did this. And yet it doesn't work. Could you share/post the workflow that you have created so far so that I could look at what you have and see if I spot a problem? Link to comment
RoboSloNE Posted April 14, 2013 Author Share Posted April 14, 2013 Sure: http://d.pr/f/PUpm Link to comment
jdfwarrior Posted April 14, 2013 Share Posted April 14, 2013 Sure: http://d.pr/f/PUpm I don't really see any issues with the bash script. The exit 0 isn't really necessary but that shouldn't prevent the script from working I wouldn't think. Looking around, I'm assuming that you installed ncmpcpp through Mac Ports? If so, did you maintain the default installation path (/opt/local/bin)? If so, the only thing I can think of is to once again try running the application from the full path. Keep it as simple as possible. For the script, just have.... /opt/local/bin/ncmpcpp toggle If it still doesn't execute, check the OS X Console.app and see if you have any error there associated with trying to run ncmpcpp. This should be an extremely simple, straight forward workflow. RoboSloNE 1 Link to comment
RoboSloNE Posted April 15, 2013 Author Share Posted April 15, 2013 Thank you very much! I should've suggested this myself I used brew, so my command looks like this: /usr/local/bin/ncmpcpp toggle And this is totally working! Link to comment
jdfwarrior Posted April 15, 2013 Share Posted April 15, 2013 Thank you very much! I should've suggested this myself I used brew, so my command looks like this: /usr/local/bin/ncmpcpp toggle And this is totally working! Awesome, glad you were able to get it working. As mentioned, Alfred doesn't import your profile for when executing scripts and such. If you dropped to a terminal and did echo $PATH Then I'm sure /usr/local/bin is probably in your path. However, if you made a simple workflow to echo $PATH and show the results in large type in Alfred, you would see that $PATH only includes /usr/bin:/bin:/usr/sbin:/sbin. This is why the command wasn't working. These are the defaults paths searched if you enter an executable name without the path. It wasn't finding the file and was therefore failing. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now