Last active
July 28, 2016 21:25
-
-
Save digiltd/21b0c1df590dd15d65c63237454eb232 to your computer and use it in GitHub Desktop.
controlling your Hue lights using the keyboard backlight brightness buttons on a MacBook Pro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- | |
Inspired by Reddit user @lzm | |
https://www.reddit.com/r/Hue/comments/4uvvfe/controlling_your_lights_with_the_backlight_keys/ | |
---> | |
<?xml version="1.0"?> | |
<root> | |
<vkopenurldef> | |
<name>KeyCode::VK_OPEN_URL_SHELL_LIGHT_OFF</name> | |
<url type="shell"> | |
<![CDATA[ | |
#!/bin/bash | |
curl -X PUT -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{ | |
"on": false | |
}' "http://192.168.1.147/api/YOUR_HUE_APP_ID_HERE/lights/2/state" | |
]]> | |
</url> | |
</vkopenurldef> | |
<vkopenurldef> | |
<name>KeyCode::VK_OPEN_URL_SHELL_LIGHT_ON</name> | |
<url type="shell"> | |
<![CDATA[ | |
#!/bin/bash | |
curl -X PUT -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{ | |
"on": true | |
}' "http://192.168.1.147/api/YOUR_HUE_APP_ID_HERE/lights/2/state" | |
]]> | |
</url> | |
</vkopenurldef> | |
<vkopenurldef> | |
<name>KeyCode::VK_OPEN_URL_SHELL_LIGHT_DECREASE</name> | |
<url type="shell"> | |
<![CDATA[ | |
#!/bin/bash | |
curl -X PUT -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{ | |
"on": true, | |
"bri_inc": -10 | |
}' "http://192.168.1.147/api/YOUR_HUE_APP_ID_HERE/lights/2/state" | |
]]> | |
</url> | |
</vkopenurldef> | |
<vkopenurldef> | |
<name>KeyCode::VK_OPEN_URL_SHELL_LIGHT_INCREASE</name> | |
<url type="shell"> | |
<![CDATA[ | |
#!/bin/bash | |
curl -X PUT -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{ | |
"on": true, | |
"bri_inc": 10 | |
}' "http://192.168.1.147/api/YOUR_HUE_APP_ID_HERE/lights/2/state" | |
]]> | |
</url> | |
</vkopenurldef> | |
<!--- | |
You must have the autogen that uses a modifier key before the one that doesn't | |
---> | |
<item> | |
<name>hue</name> | |
<identifier>hue</identifier> | |
<autogen> | |
__KeyToKey__ | |
ConsumerKeyCode::KEYBOARDLIGHT_LOW, ModifierFlag::CONTROL_L, | |
KeyCode::VK_OPEN_URL_SHELL_LIGHT_OFF | |
</autogen> | |
<autogen> | |
__KeyToKey__ | |
ConsumerKeyCode::KEYBOARDLIGHT_LOW, | |
KeyCode::VK_OPEN_URL_SHELL_LIGHT_DECREASE | |
</autogen> | |
<autogen> | |
__KeyToKey__ | |
ConsumerKeyCode::KEYBOARDLIGHT_HIGH, ModifierFlag::CONTROL_L, | |
KeyCode::VK_OPEN_URL_SHELL_LIGHT_ON | |
</autogen> | |
<autogen> | |
__KeyToKey__ | |
ConsumerKeyCode::KEYBOARDLIGHT_HIGH, | |
KeyCode::VK_OPEN_URL_SHELL_LIGHT_INCREASE | |
</autogen> | |
</item> | |
</root> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment