Benzi Posted October 29, 2013 Share Posted October 29, 2013 Just another quick way to look at the battery levels of your connected Apple devices: Keyword is battery. Download from here. Credits to a script found here: http://www.macosxtips.co.uk/geeklets/system/battery-status-for-apple-wireless-keyboard-mouse-and-trackpad ftrava, thec13, moiraine and 1 other 4 Link to comment
politicus Posted October 30, 2013 Share Posted October 30, 2013 @Benzi is there a way your workflow notifies me via Growl when my battery energy level is at X%? I use one other battery workflow + bartender -> I do not get any warning message. Link to comment
Benzi Posted October 30, 2013 Author Share Posted October 30, 2013 @Benzi is there a way your workflow notifies me via Growl when my battery energy level is at X%? I use one other battery workflow + bartender -> I do not get any warning message. No, unfortunately not at the moment. This should be possible though, with some sort of background app/daemon that subscribes to battery level notifications via OS X; sadly, I don't have enough know how to implement something like that yet. (maybe if I get some free time...) Link to comment
politicus Posted October 31, 2013 Share Posted October 31, 2013 If it is technically possible, I'll be patient Link to comment
theboyler Posted November 2, 2013 Share Posted November 2, 2013 Hi Benzi - would it be possible to amend this so that when you select the computer battery, you get all the info from your first battery workflow (cycle count , health etc)? Link to comment
DJay Posted November 2, 2013 Share Posted November 2, 2013 Great. Thanks for you work and sharing. I use the Logitech Bluetooth Easy-Switch Keyboard K811. Do you think there's a way to get the battery status of other devices than from Apple? Also I use the Phone Amego App together with the great Uni Call Workflow from guiguan. Phone Amego can show the Battery Status of the connected iPhones. You see a chance for that? Once again, thanks for you work and ideas. Really appreciate. Link to comment
rice.shawn Posted November 4, 2013 Share Posted November 4, 2013 I never know how to feel about writing a background daemon for these sorts of things as Alfred workflows. The point of Alfred is to invoke things manually. Writing a daemon is really more of writing an application, and so packaging it as a Workflow is possible, but, again, I'm not sure if it should happen. Although, if you do want to make it happen, then you'd need to do a few things: look at this stackoverflow discussion. That would make it so that it really isn't a daemon that runs all the time, but, instead, it would be a script invoked at certain times. For the workflow, you'd probably want to put in an "install" command that would copy the relevant file that is packaged with the Workflow to the relevant place (if you're using launchctl). If you're using Cron, then you'd want to write an entry to the crontab, but you'd also want to make sure that it doesn't add in the line multiple times because, then, the command would be run too often. I'd recommend invoking the install with an applescript so that you can put in the line "with administrator permissions" or whatever it is exactly. Otherwise, you'd have to use 'sudo'. If you want to run it as a daemon, what you can do is to write a bash script that runs the script and receives the output and then sleeps for however long you want it to sleep. When you do this, make sure that you 'disown' the process. Otherwise, an Alfred thread will be continually running, which will interfere with Alfred's normal functioning. Include a command to kill the daemon. Also, make sure that the daemon isn't launched multiple times (you can use 'ps aux|grep <daemon name>|grep -v grep'; then, if there is any output, it'd mean that the daemon is running and not to launch it again. To kill it, instead of finding the process, you could just invoke the "killall" command in which you'd just send "killall <processname>". This setup would make it so that Alfred would have to launch it and kill it. So, it won't be started each time you reboot your computer. If you want to do that, you'll have to include it in the start-up items (which I think is a bit harder with Mavericks). I'd also recommend putting in a "status" command with Alfred to see if the daemon is running. For the notifications, you have a few options: you could write an applescript that will send a dialog whenever things are low. However, this will be intrusive. You could also invoke growl to send the messages (this requires a tiny bit of configuration with growl and you can't assume growl is installed). The third way would be to package the ruby gem 'terminal-notifier' which creates regular notifications. You'd just invoke the script and make the notification sticky. So, with this approach, the Alfredworkflow would just install and manage the daemon or cron job. You'd also want to put in an uninstall command (especially if you're using cron, and you'd want to have an automatic uninstallation feature if the workflow is deleted). But, again, I'm uneasy about using Alfred to write daemons. Temporary ones are fine (think of a timer that works similarly to what I've outlined above, but one that stops itself after a certain amount of time), but daemons that become a perennial part of your system just seem like something that is entirely different than Alfred. Lastly, if you do write something that includes a daemon that runs permanently, then I believe that you should make it clear and explain how the daemon works when you release the Workflow. That way people know what you're putting on their computer. --Shawn Benzi and fbarros 2 Link to comment
Benzi Posted November 5, 2013 Author Share Posted November 5, 2013 Hi Benzi - would it be possible to amend this so that when you select the computer battery, you get all the info from your first battery workflow (cycle count , health etc)? That is possible; although, at the moment, since both workflows have the same keyword "battery", I'd have to change both workflows. Keeping the old one as is, I'll modify this version to include those battery details (cycle count and health mainly). I'll share an updated version soon Link to comment
Benzi Posted November 5, 2013 Author Share Posted November 5, 2013 Great. Thanks for you work and sharing. I use the Logitech Bluetooth Easy-Switch Keyboard K811. Do you think there's a way to get the battery status of other devices than from Apple? Also I use the Phone Amego App together with the great Uni Call Workflow from guiguan. Phone Amego can show the Battery Status of the connected iPhones. You see a chance for that? Once again, thanks for you work and ideas. Really appreciate. That keyboards looks sweet! Regarding getting the battery status I'm not sure. Even if there is some way to get those details technically, I'd have no way to check and test it out because I don't own those devices. So this may not be possible at the moment. The iPhone status sounds like a good idea, I'll dig around and see if I can come up with something. Again, no promises! Link to comment
Benzi Posted November 8, 2013 Author Share Posted November 8, 2013 Hi Benzi - would it be possible to amend this so that when you select the computer battery, you get all the info from your first battery workflow (cycle count , health etc)? As a start, I have updated this workflow to display more information as is - so no need for the other workflow. I'll see what more I can add to this, meantime though go ahead and download the latest version and try it out. Link to comment
sstrool Posted November 16, 2015 Share Posted November 16, 2015 (edited) just tried the workflow and it does not recognize the new magic keyboard or magic trackpad2. I am also on OSX 10.11. Edited November 18, 2015 by sstrool Link to comment
Serge Posted December 3, 2015 Share Posted December 3, 2015 It doesn’t work either with the Magic Mouse 2. Link to comment
Zeno Posted September 16, 2016 Share Posted September 16, 2016 (edited) I've updated it. It only works with thew magic stuff: UPDATED LINK: http://zeno.in/2dhSzPe Edited October 14, 2016 by Zeno Link to comment
Southgirl Posted October 10, 2016 Share Posted October 10, 2016 On 16/9/2016 at 0:23 PM, Zeno said: I've updated it. It only works with thew magic stuff: http://zeno.in/hUR2 Just tried to use it. This one is not working either. Link to comment
Zeno Posted October 14, 2016 Share Posted October 14, 2016 It only works with the Magic Mouse and Magic Keyboard. Older versions do not work. Link to comment
flex Posted October 20, 2016 Share Posted October 20, 2016 # mouse #MousePercent=`ioreg -c AppleDeviceManagementHIDEventService | grep 'Magic Mouse' -A6 | grep BatteryPercent | sed 's/[a-z,A-Z, ,|,\",=]//g' | tail -1 | awk '{print $1}'` MousePercent=`ioreg -n "BNBMouseDevice" | grep BatteryPercent | sed 's/[a-z,A-Z, ,|,\",=]//g' | tail -1 | awk '{print $1}'` helped me on the latest macOS. Link to comment
Southgirl Posted October 20, 2016 Share Posted October 20, 2016 On 14/10/2016 at 7:11 PM, Zeno said: It only works with the Magic Mouse and Magic Keyboard. Older versions do not work. I have Magic Keyboard 2. Tried to debug it, but nothing appears when prompted. Link to comment
ckotte Posted March 1, 2017 Share Posted March 1, 2017 the link is down? where can I download the version that's compatible with macOS Sierra and Magic Keyboard/Trackpad 2?? 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