2
1
I'm using GeekTool, which takes the output of terminal commands and turns them into Desktop widgets, and wanted to display the current battery percent of my bluetooth keyboard to the Desktop in the form of
Keyboard Battery: (Battery percent value)
In order to accomplish this, I am using the command
ioreg -c AppleBluetoothHIDKeyboard |grep '"BatteryPercent" ='
which is from this website.
However, as mentioned on that website, this command outputs this not-very-clean-looking text (yes I need to change my batteries):
| | | | "BatteryPercent" = 17
(So, for this input, I want the output Keyboard Battery: 17
.)
Therefore, my question is, how do I convert this into my intended format of "Keyboard Battery: (Battery percent value)" via the command line?
EDIT: I have found another way to show the battery percent, using Ubersicht instead of GeekTool, thank you all for your help
So, do you want
Keyboard Battery: 17
orKeyboard Battery: (17)
? I.e., do you want literal parentheses in the output? – G-Man Says 'Reinstate Monica' – 2016-07-01T20:23:40.397Keyboard Battery: 17 – D4rKP01s0n – 2016-07-01T20:28:59.940
Please don’t clarify your question in comments; [edit] your question to make it clearer and more complete. Several of us have put some effort into answering your question. If you don’t want an answer any more, say so and walk away, and we’ll leave you alone. But if you want a solution, copy our answers *into your question* and show the output you get *in your question*. Use copy & paste from our answers to your Terminal, and from your Terminal to your question. – G-Man Says 'Reinstate Monica' – 2016-07-02T22:40:14.360