weixin_39983563
weixin_39983563
2020-12-09 01:10

Toggle isn't really a toggle

The keyboard toggle command doesn't toggle the state of the led. You have to specify if you want to turn it off or on: it's a set, not a toggle. Can you add an option to toggle the state?

I had to write this terrible script to do it:

 bash
s=($(maclight keyboard toggle -v))
[ "${s[1]}" = 0 ] && maclight keyboard toggle -n 1 || maclight keyboard toggle -n 0

该提问来源于开源项目:busyloop/maclight

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

5条回答

  • weixin_39743603 weixin_39743603 5月前

    Sorry, don't have time for an update right now (a pull request would be considered).

    For brevity you could use this one-liner: ruby -r maclight -e 'MacLight.capslock(!MacLight.capslock)'

    点赞 评论 复制链接分享
  • weixin_39983563 weixin_39983563 5月前

    It's not important, don't worry. I'll give a look at the code but I have never used ruby before. Thank you.

    点赞 评论 复制链接分享
  • weixin_39983563 weixin_39983563 5月前

    I added the new option: it works fine. https://github.com/busyloop/maclight/pull/2

    点赞 评论 复制链接分享
  • weixin_39743603 weixin_39743603 5月前

    Thanks mate!

    I've made a new release containing your change, you can update with gem install maclight.

    点赞 评论 复制链接分享
  • weixin_39983563 weixin_39983563 5月前

    Good. I close the issue then.

    点赞 评论 复制链接分享

相关推荐