Giter VIP home page Giter VIP logo

setledsmac's Introduction

SetLEDs for Mac OS X

This command-line tool lets you set your keyboard LEDs. This is especially useful if you have a back-lit keyboard and don't want scroll lock, number lock or caps lock to remain unlit.

Note

Setting the LED on or off does not affect the behavior of that key so even though the led for caps lock will be on caps lock itself will still be off. Tapping the key will cause the lock to come on but the LED will already be on so it will not appear to change. Tapping it again will turn it off (and cause the LED to turn off).

Usage

You can set LEDs by simply specifing either a - to turn an LED off, a + to turn an LED on or a ^ to toggle an LED followed by either the word scroll (for scroll lock), num (for numeric lock) or caps (for caps lock). e.g.

setleds -caps +scroll ^num

Name matching

By default setledsmac will set the modifiers for all keyboards attached to your Mac. If you wish to limit it you can use the -name parameter followed by a wildcard. Note that if you want to use a space then specify the wildcard in quotes, e.g.

setleds +scroll -name "Apple Key*"

Verbose mode

setledsmac will report what keys it changed for each keyboard. This is sometimes different per keyboard if either the keyboard does not have that modifier (e.g. Apple keyboards do not have scroll lock) or if the keyboard already had that LED on.

Specifying -v on the command line will cause setledsmac to report the state of the other unchanged modifier keys on that keyboard too. Note that you will not see the state of modifiers that keyboard does not have.

setledsmac's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

setledsmac's Issues

Karabiner + setledsmac

I read the issue #7, and found a workaround to that.

There were an answer suggesting to kill Karabiner then restart it (#7 (comment)) . I found that you can disable a device in Karabiner without killing it, under Devices tab. After that you can simply use setledsmac, then you can turn tis settings back immediately.

Also found that, this is easily scriptable, because you can change this setting in ~/.config/karabiner/karabiner.json . You can iterate /profiles/devices and check ./identifiers/product_id/vendor_id to find the device settings. If you found that, you can set ./ignore to true, use setleds, then set back to false. The file is processed by Karabiner automatically, no need to run any command.

I think this could be part of setledsmac, because Karabiner is essential to make numlock function works on external keyboars.

`setledsmac` fails with code `kIOReturnExclusiveAccess`

Hi,

Just for the sake of sharing it ---

I am on 10.11.5, Xcode 7.3.1, and at first it failed with EXC_BAD_ACCESS at main.c:109:

image

currentValue held the integer value 0.

Then I commented the block and made a necessary change at line 113 (remove the check of changes[led] against current):

image

It can be seen in the debugger window (at the lower right) that changeResult held the value 0xe00002c5, which is error code kIOReturnExclusiveAccess.

I Googled a bit with it, and it basically means what it says --- the HID manager is "hijacking" it.
And there are advices saying a codeless kext may be helpful to prevent the hijack / hogging.

I will look more into it when I have the chance.
It'd be great if you could confirm this behavior on your systems and also work on a fix. :)

Option to set state for same key sequentially

Currently setting the sate for multiple keys is possible

setleds -caps +scroll ^num

However setting the state for the same key is not

setleds +caps -caps (to mimic setleds +caps && setleds -caps)

Add blinking support

Hello, thanks for a nice tool. Can you please add feature of blinking?
I want to use scroll lock as indicator. So when look at my keyboard i would see some pattern that would tell me smth is happening.
Please add such option. Proposed parameters are

  • num of blinks
  • delay between blinks
    or, even better —
    binary pattern of 1 and 0 and interval between, for example:
  • 1 100 0 100 1 50 0 50 — one fast blink, one slower blink
    i can simulate this if using this tool in while cycle, but it consumes resources.

Thanks in advance!

Can't use with karabiner-Element 11.4.0

Mac Book Pro 2012 later with High Sierra 10.13.1

sudo setleds -v result:

    SetLEDs version 0.2 - http://github.com/damieng/setledsmac

     "Apple Internal Keyboard / Trackpad" ?num ?caps ?scroll

    Some state could not be determined. Please try running as root/sudo.`

scroll led can't be set

I'm on OSX Yosemite (10.10.5) on a legit MacBook Pro, using CODE as my keyboard.
setledsmac can only set the leds for caps and num.
scroll doesn't work and it doesn't even appear when I do setledsmac -v

$ setleds -v
SetLEDs version 0.1 - http://github.com/damieng/setledsmac
 "USB Keyboard" -num -caps
 "Razer Imperator"
 "Apple Internal Keyboard / Trackpad" -num -caps
$ 

IOHIDDeviceSetValue returns kIOReturnNotOpen

captura de pantalla 2016-10-01 a las 12 40 29

Like in this other issue, I also had to comment the lines referring to get the current value to avoid the segmentation fault. But then, IOHIDDeviceSetValue returns 0xe00002cd which according to this means kIOReturnNotOpen... I also tried running it with root privileges but nothing changed.

My keyboard is a Ducky Shine 5 and I'm using it on a hackintosh Sierra. I think the latter will be the key...

Does this work on Mac OS 13?

Can't get this to work on Mac OS 13 with the prebuilt binary ... does this api still exist to turn the leds on past OsX?

scroll led doesn't work

Hi, I've downloaded your code. It works well but without recognising the scroll led in some my keyboards (that is what I need). Do you have any suggestion on why?

Version 0.2 showing non-existent led (scroll lock)

Maybe a regression, version 0.2 is showing scroll lock for my MBP keyboard. Version 0.1 correctly shows only num lock and caps lock.

❯ setleds -v

SetLEDs version 0.1 - http://github.com/damieng/setledsmac

 "Apple Internal Keyboard / Trackpad" -num -caps 

❯ setleds -v

SetLEDs version 0.2 - https://github.com/damieng/setledsmac

 "Apple Internal Keyboard / Trackpad" -num -caps -scroll 

Add quiet mode

Add -q flag to omit output.

❯ setleds ^num

SetLEDs version 0.2 - https://github.com/damieng/setledsmac

 "Apple Internal Keyboard / Trackpad" +num

❯ _
❯ setleds -q ^num

❯ _

setleds -v results in: Some state could not be determined. Please try running as root/sudo.

I am running OSX 10.13.5, and when I try setleds -v or sudo setleds -v I get the following output:

SetLEDs version 0.2 - http://github.com/damieng/setledsmac

 "Karabiner VirtualHIDKeyboard"

 "Realforce 87" ?num ?caps ?scroll

Some state could not be determined. Please try running as root/sudo.

 "(null)" ?num ?caps ?scroll

Some state could not be determined. Please try running as root/sudo.

 "Apple Internal Keyboard / Trackpad" ?num ?caps ?scroll

Some state could not be determined. Please try running as root/sudo.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.