If MOUSEBATTERY is less than COMPARE, displays a Notification in macOS with the current battery level.If no device is found, it exits the script.Sets the value of COMPARE to the first script argument or the default (15).Grabs the name of the device MOUSENAME & its battery percentage MOUSEBATTERY.check_mouse_battery.sh 10 MOUSENAME= `ioreg -c AppleDeviceManagementHIDEventService -r -l | grep -i mouse | cut -d = -f2 | cut -d \" -f2` MOUSEBATTERY= `ioreg -c AppleDeviceManagementHIDEventService -r -l | grep -i mouse -A 20 | grep BatteryPercent | cut -d = -f2 | cut -d ' ' -f2` COMPARE=$\"" fi #!/bin/sh PATH=/usr/local/bin:/usr/local/sbin:~/bin:/usr/bin:/bin:/usr/sbin:/sbin # Script that checks the battery level of a connected mouse and displays a notification if it is below a threshold (default 15%). I wrote a couple of bash scripts to work-around this issue, one for the mouse and another for the keyboard. The main tool we can use to access this information is ioreg ( the I/O Registry). Luckily a lot of things within macOS is accessible through command line tools. I searched around and could not find a setting or even a plist entry to change that. Charging it is not something I can do while I'm trying to work. To me, that's a bit too close to death to let me know its battery is getting low and I needed more warning than that - especially given that the Apple Magic Mouse 2's Lightning port is on the bottom of the mouse. As usual, if you have any questions or other battery life tips, just use the Comments form below.For some reason, macOS has a very low threshold set for bluetooth batteries (such as the Magic Mouse & Keyboard). I hope this Mac keyboard/mouse battery level tip has been helpful. Mac keyboard/mouse battery level tip - Summary Just follow these steps:ġ) Click the Apple icon on the Mac menu bar, and select System Preferences.Ģ) When the System Preferences dialog comes up, click the Bluetooth icon:ģ) On the Bluetooth dialog that comes up next, click the "Show Bluetooth status in the menu bar" checkbox:Īs soon as you do this you'll see that Bluetooth icon on the right side of the Mac menu bar, after which you can view your keyboard and mouse battery levels. If the Bluetooth menu I just described isn't on your Mac menu bar, fear not, it's easy to get it there. Enabling the Mac Bluetooth menu (to see the battery levels) If you use rechargeable batteries like I do, it can be very nice to know these levels before they go to zero, because I can pull all my batteries on evening, charge them up, and put them back in the next day. My Mac mouse is named "Al's mouse", and my Mac mouse battery level is currently 51%. To see your Mac mouse battery level, do the same thing: Click the Bluetooth menu, find your mouse on the menu, and hover over that item. When you hover over that item you'll see your Mac keyboard battery level (mine shows up as "43%"). On that menu you can see your Mac keyboard battery level by clicking that icon, then scrolling down to your "keyboard" menu item (mine is named "Al's keyboard"). (This is something like the normal Bluetooth icon, but a little different.) This menu will be in the upper-right corner of the Mac menu bar, and it looks like three small dashes with some other figure behind those dashes. The easiest way I know to see the Mac keyboard/mouse battery level is to put the Bluetooth menu on your Mac menu bar, and check it from there. Mac mouse/keyboard battery FAQ: How can I check the battery level of my Mac mouse or Mac keyboard?
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |