Flic for Mac?


  • FlicTeam

    Hi,

    Today we are trying something new. We have since the very first release of Flic received a lot of requests from you about using Flic on other devices than their smartphones. While we have had a beta version of a Linux SDK up for a while, Mac support is something we have always wanted to do.

    Unfortunately we do not have the development recourses in order to expand our main application to multiple platforms. This has been bothering us since we know that we, and our customers, are missing out on potentially good use cases. It was due to this that we asked ourself a few days ago wether or not we could add Mac support within just a few days of work. The answer to that question turned out to be "Yes, if we cut the application down to an absolute bare minimum and let our users create the actions on their own".

    So, today we are taking our first small step towards Flic compatibility on Mac OSX with an application that we call HaxWithFlic. This application is very simple and in fact, on its own, does not do much at all. The only thing the app will let you do is to use Flic to trigger scripts on your computer. That's it, no fancy UI, no user log in, no actions.

    This application is available for download on GitHub along with a few sample scripts that we have added to get you going. We kindly ask you to submit your comments/suggestions/issues on GitHub rather than sending in support mails so that we can better keep track of it. You are also welcome to discuss it here on the forum as well. Please note that the application is in an Alpha stage and its functionality in upcoming versions may change without notice. While we do realize that this type of application is not for everyone, we still hope that it will be useful to as many of you as possible. Also, this should work perfectly fine with any Flic button, regardless of the batch it originates from.

    Thanks,
    Anton @ the Flic team


    HaxWithFlic Requirements and Instructions

    This app requires OSX 10.10 or above operating systems running on a machine that supports Bluetooth Low Energy. A Bluetooth Low Energy compatible USB dongle can in some cases work as well. Once installed, this application will allow you to connect one Flic button to your Mac computer and then select which scripts that you wish to execute on click, double click, hold, up and down.

    Important notice:

    Since this application will blindly execute the scripts that you tell it to execute, it is very important that you make sure that you know what these scripts do. You need to verify, or have verified by someone who you trust, that the code being executed is not malicious in any way. We will not take responsibility for any harm that you may cause to your machine.

    Supported script files

    The following files are supported:

    • Automator workflows (.workflow)
    • All other files that are executable (chmod +x a_script.py) and contains a shebang on its first line (#!/some/path)

    Some examples of supported files:

    • AppleScript - .scpt, .AppleScript - #!/usr/bin/osascript
    • Shell Script - .sh - #!/bin/sh
    • Ruby Script - .rb - #!/usr/bin/env ruby
    • Python Script - .py - #!/usr/bin/env python

    This can of course vary a bit depending on how your Mac is configured.

    Installation

    1. Download the repository by pressing the "Download ZIP" button.
    2. Mount the dmg file and drag and drop the HaxWithFlic.app to your applications folder.
    3. When launching the application from the applications folder the first time it will ask you if you want to open a file that was downloaded from the internet. Press open.
    4. Press on the flic icon in the menu bar and start using the application. For example, press scan if you want to add a new Flic.

    Configuration

    1. Press “Configure scripts..”.
    2. Add search paths to the scripts you want to launch.

    Please note that some actions (like window resizing) requires that you add HackWithFlic to the accessibility list under the privacy settings of your mac. By default the app plays audio notifications on button presses, but these can be turned off by unchecking the "Play audio" option. If you are using the button for tasks that require very low latency then you can lower the latency by checking the "Low latency mode" option, but remember that this will decrease the battery life of your Flic significantly. The low latency mode reduces the latency down to 45ms from the normal 280ms. Notice, however, that these are worst case times and that the expected time is about half of that. The button down event always arrives before any other event, so it can be used for time critical applications.



  • @anton said in Flic for Mac?:

    @tcbeatie Cool! Good that you solved it. Regarding the triggers, as you see we do provide the "raw" buttonUp and buttonDown events. This means that you should be able to create a script in which you can define your own click types. Also, have a look at flic-service-osx if you ever feel like making something even more complex ;)

    I saw references to that, but not sure how to implement. Easiest might be a triple click?

    My current use case is a button in the kitchen that controls the mac next door; volume up/down/pause|play is easy.. A triple click to do something cool like speak the weather would be awesome :)


  • FlicTeam

    @tcbeatie Cool! Good that you solved it. Regarding the triggers, as you see we do provide the "raw" buttonUp and buttonDown events. This means that you should be able to create a script in which you can define your own click types. Also, have a look at flic-service-osx if you ever feel like making something even more complex ;)



  • @anton Thanks for responding! Turns out it was just my inexperience with AppleScript. I was using the AppleScript Editor to try and create the script, when I should have been just using a text editor. Working great now!

    I just wish there were more than three modes :) Just one more even!


  • FlicTeam

    @tcbeatie said in Flic for Mac?:

    I'm trying to set up the Flic for the simple task of turning the master volume up or down on my Mac. My script is the following;

    #!/usr/bin/osascript
    set curVol to output volume of (get volume settings)
    if curVol > 90 then
    set volume output volume 100
    else
    set volume output volume (curVol + 10)
    end if

    and yet when I load it into Flic, and then hit the button, I get "File at path did not contain a shebang: {file location}"

    Help?

    Thanks!

    Well I don't know exactly what may be the issue here, but lets start with some simple troubleshooting before I dig any deeper:

    • Are you sure that you don't have any spaces or new lines at the start of the file? The '#' has to be the first character in the file.
    • Are you sure that all file permissions are set correctly? Obviously the program would have to read the file.

    /Anton



  • I'm trying to set up the Flic for the simple task of turning the master volume up or down on my Mac. My script is the following;

    #!/usr/bin/osascript
    set curVol to output volume of (get volume settings)
    if curVol > 90 then
    set volume output volume 100
    else
    set volume output volume (curVol + 10)
    end if

    and yet when I load it into Flic, and then hit the button, I get "File at path did not contain a shebang: {file location}"

    Help?

    Thanks!


  • FlicTeam

    @markinnewy said in Flic for Mac?:

    Hello,

    I have the app installed and working fine with some applescripts. However, for some reason, the app won't run a simple shell script. I have a script (Toggle.sh) that uses the 'lightsd' deamon to toggle my lifx lights. This is the script's contents:

    #!/bin/bash
    . lightsd --prefix/share/lightsd/lightsc.sh
    lightsc power_toggle ${*:-'"d073d503a71f"'}

    I've made sure this file is executable. From the terminal, I can type either sh Toggle.sh, or, ./Toggle.sh and it works perfectly. However, when I assign this script to a flic action, and click the button, nothing happens. The logs show "HaxWithFlic: Script return value:" and then nothing further.

    Can anyone help?

    I am not really familiar with lightsd, so I don't know how you have configured it. But you should keep in mind that nested scripts within your script will be run relative to the root path and not the path where your script lies. Perhaps that is something to take a look at? Otherwise I don't know. Maybe try and implement something easier (such as this one) and see if that works first.



  • Hello,

    I have the app installed and working fine with some applescripts. However, for some reason, the app won't run a simple shell script. I have a script (Toggle.sh) that uses the 'lightsd' deamon to toggle my lifx lights. This is the script's contents:

    #!/bin/bash
    . lightsd --prefix/share/lightsd/lightsc.sh
    lightsc power_toggle ${*:-'"d073d503a71f"'}

    I've made sure this file is executable. From the terminal, I can type either sh Toggle.sh, or, ./Toggle.sh and it works perfectly. However, when I assign this script to a flic action, and click the button, nothing happens. The logs show "HaxWithFlic: Script return value:" and then nothing further.

    Can anyone help?


  • FlicTeam

    @frank said in Flic for Mac?:

    said in Flic for Mac?:

    press scan if you want to add a new Flic

    Hi, I just downloaded and installed the app. I have a flic-icon in my menubar but when I scan for my Flic I get the error message that no Flic was found in the proximity. Even when pressing the Flic button really close to my laptop, it doesn't find it. The button works well with the iPhone app. How do I move forward?

    Thanks
    Frank

    I have noticed once before, on one mac, that the Bluetooth stack in the computer, for some reason, stopped delivering advertisement packets to the application layer. This may be what has happened to you as well. I have no idea why it happened, but when it happened to me I actually had to restart the computer for it to be solved. If you can try doing that then it would be great. If you are still having issues after that, then I will have to take a closer look.



  • said in Flic for Mac?:

    press scan if you want to add a new Flic

    Hi, I just downloaded and installed the app. I have a flic-icon in my menubar but when I scan for my Flic I get the error message that no Flic was found in the proximity. Even when pressing the Flic button really close to my laptop, it doesn't find it. The button works well with the iPhone app. How do I move forward?

    Thanks
    Frank


  • FlicTeam

    @sandra.kaercher said in Flic for Mac?:

    I'm using the lockscreen.applescript that came with the file but I'm getting a "File not executable. File path is not executable. /User/MYNAME/Documents/lockscreen.applescript" error. The sleep.sh script seems to work fine.

    Anyone experienced this?

    Hello, I don't exactly know which script you are referring to since the repository does not contain a script named 'lockscreen.applescript'. The error , however, suggests that you are trying to execute a file that you do not have permission to execute. You can look up the file permissions by going to the correct path in the terminal and then run ls -l. Here is an article that explains file permissions in more details if you are curious. But in short, you should see at lest one 'x' in the file permission list for that file. If not, then simply run chmod +x your_script_file to add the execute permission.

    Did any of this help? :P



  • I'm using the lockscreen.applescript that came with the file but I'm getting a "File not executable. File path is not executable. /User/MYNAME/Documents/lockscreen.applescript" error. The sleep.sh script seems to work fine.

    Anyone experienced this?



  • Thank you for this! I'm using my Flic as a doorbell for my recording studio (the Hue lights blink when it is pressed) and while using my phone worked, I would sometimes wander out of range with it. Having the Flic on my desktop computer allows the whole system to be much more reliable!



  • @anton LOL, I didn't see that there is a Hue script. I am using a self written ruby script to control my Hue's. I solved the "toggle"-Feature script-based with a status check on the Hue bridge.


  • FlicTeam

    @marco.roth said in Flic for Mac?:

    This is awesome 😊

    I controll Hue's with my flic. The only thing, which would be nice if you can "toggle" for example the click event.

    The first click will turn on the lights and the second click will turn them off.
    So that every 2nd click an other script will be executed. So it would work like a normal light switch :)

    Thanks!

    Are you using the Philips Hue script that is in the repository? The reason why I am asking is since it should toggle between on/off. Although it would be a nice feature to have the toggle ability directly in the app. Although when we release our official Flic app for Mac it will have native Philips hue support of course.

    /A



  • This is awesome 😊

    I controll Hue's with my flic. The only thing, which would be nice if you can "toggle" for example the click event.

    The first click will turn on the lights and the second click will turn them off.
    So that every 2nd click an other script will be executed. So it would work like a normal light switch :)



  • works great - 10.11.4 on MacBook Pro (Retina, 15-inch, Mid 2015)


  • FlicTeam

    @krishnavamsi said in Flic for Mac?:

    Today installed the same on MAC and integrated lifx bulb through flic button.

    Cool! I think other people might want to know how you did the LIFX integration :)


  • FlicTeam

    @jonmichaels said in Flic for Mac?:

    @anton I'm not sure how you're judging interest in the the Mac app, but I'd just like to add my name to the list of people saying "This is great!" Also, I would love to be able to add more than one button. What's the best way to find out when there's been an update to the app?

    Thanks, I appreciate the comment :) Well I think by now we are very convinced that we will move ahead and create a complete app for mac. We have many great ideas, such as adding the option for it to support our fliclib client/server TCP protocol (as used in our Linux SDK). That way we could easily send and receive events between different devices on the network, but also between different apps on the computer, which I think would be cool. Also, porting over much of the cloud/LAN actions from our mobile apps is a no-brainer as well.

    The only thing that we are not sure about at this moment is if we should do a quick fix to the current mac app to add multiple button support before we move over and start working on the big update.

    Regarding updates to the app, there are currently no good way to to know for sure when there's been an update to the app. Minor updates will be pushed to GitHub without notice, but with larger updates we will most certainly post here on the forum as well, perhaps even send an email update about it. In the future we will of course have a version check in the app so that it can send a notification when there is an update available.



  • Today installed the same on MAC and integrated lifx bulb through flic button.



  • @anton I'm not sure how you're judging interest in the the Mac app, but I'd just like to add my name to the list of people saying "This is great!" Also, I would love to be able to add more than one button. What's the best way to find out when there's been an update to the app?


Log in to reply