50ButtonsEach / hax-with-flic-osx

Basic Flic application for Mac.
105 stars 13 forks source link

direct commands #1

Open yetzt opened 8 years ago

yetzt commented 8 years ago

i'd like to write my commands directly into the configuration instead of "choosing a file". i'd like to simply /usr/bin/say butts without #!/bin/sh and butts.sh. please adjust the interface accordingly.

AntonMeier commented 8 years ago

You have a good point. I will make sure to add support for that in the new version.

yetzt commented 8 years ago

thanks!

erikvg01 commented 8 years ago

I'm not sure how the script is being executed by the flic app on OSx, but it seems that it does not execute nested scripts. I have a script that calls another script conditionally, and the flic trigger seems to never execute the sub script... I cannot replicate the behavior outside of using the flic app.

AntonMeier commented 8 years ago

Interesting, I will take a look at that.

AntonMeier commented 8 years ago

The nested scripts that you refer to, is it executed related to the path of the main script? If it is then try to run it with an absolute path. I believe all scripts, including nested, will be run relative to the root.

erikvg01 commented 8 years ago

Root is able to execute the script, and it does reside in $PATH on the box. I tested with absolute path, and it still does not work. Mine is likely a corner case, and I have a workaround in place...Now I just need multiple buttons.

jonathan-dejong commented 8 years ago

I think I have a similar situation.. Just got the flic to work (Thanks @AntonMeier!) and decided to write a tiny shell script to boot up my vagrant enviroment.

vagrantup.sh:

#!/bin/sh
#function to display commands
exe() { echo "\$ $@" ; "$@" ; }
exe echo start vagrant
startdev
exe echo vagrant started

And I have added an alias to .bashrc alias startdev="cd ~/sites/vvv && vagrant up"

This works when I run the script from terminal (I've put the file in a folder "flic" on user root) cd flic && . vagrantup.sh

but when I attempt to have flic run it nothing happens. I get a beachball on the actual flic app in the menu bar which tells me it attempts to do something but alas nothing happens and the beachballs disappear after a while.

EDIT: In the systemlog this appears:

2016-05-13 16:09:11,077 HaxWithFlic[14107]: Script return value:
$ echo start vagrant
start vagrant
$ echo vagrant started
vagrant started

which would be right since it's the same as is being echoed to the terminal if I run the script from there. But it seems it just skips the alias.

AntonMeier commented 8 years ago

I don't think alias works outside of bash. Try changing your script so that it does the cd ~/sites/vvv and vagrant up in the shell script directly.

So, instead of using startdevyou can try:

cd ~/sites/vvv
vagrant up

Perhaps you have to do some ./vagrant up or something.. play around with it.

jonathan-dejong commented 8 years ago

Hmm but cd inside a shell script does not seem to work on its own according to "the internet". That's the reason I created the alias in the first place :)

But I'll try some variations and post back my results (for future devs)