Giter Site home page Giter Site logo

vchlum / wireless-hid Goto Github PK

View Code? Open in Web Editor NEW
22.0 22.0 7.0 228 KB

This Gnome shell extension shows the battery of the wireless keyboards and mice in percentages and colors. Multiple devices are supported.

Home Page: https://extensions.gnome.org/extension/4228/wireless-hid/

License: MIT License

JavaScript 93.77% Shell 0.55% CSS 0.35% Makefile 5.33%
gnome-shell-extension keyboard mouse wireless

wireless-hid's People

Contributors

a-duck avatar egormanga avatar glerroo avatar jp7677 avatar stuarthayhurst avatar vchlum avatar

Stargazers

 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

wireless-hid's Issues

[Feature Request] Support for Razer peripherals

Awesome, extension for my bluetooth keyboard and xbox controller! Unfortunately my mouse doesn't seem to be supported. Would it be possible to also add support for Razer peripherals? There already exists a project which leverages OpenRazer for that, but unfortunately I can't get it working on fedora 37 currently and it would be nice to have everything in the same place.

GNOME 46: Apple Magic Trackpad always shows 0% or 100%

This extension used to work on GNOME 45, but on Fedora 40 Atomic with GNOME 46 desktop, I have only ever seen it report as 0% or 100% at all times. Also, if I plug it in with a cable, I usually see two devices, one for the Bluetooth, one for the wire. It seems to show the battery level correctly if I have it plugged in.

Other devices seem to work. I have some wireless game controllers that work, when I plug in my iPhone, it tells me the charge somehow. Not my Apple Magic Trackpad though.

This is the product I'm using.

Side note: I can highly recommend this product to any GNOME user, it is fantastic on Linux, especially for gestures!

Additional information:

This may be unrelated but, if I enable my 2007 Apple Mighty mouse at the same time, the Magic Trackpad disappears from the menu for some reason, but works just fine regardless. The battery indicator works on the Mighty Mouse, btw.

[RFE] Include the % in the bar itself

Currently in order to check the %, you need to click on the extension icon and I think it would be nice if the battery is shown in the bar itself instead.

Refresh interval?

I've noticed that while upower and Gnome's settings app show my keyboard (MX Keys) is now at 50% power, the gnome extension doesn't see that yet. Is there some sort of refresh interval?

GNOME 42 Compatibility

Hi,
I just upgraded my Gentoo to GNOME 42... and the extension has been disabled because it's not compatible with this newer version of GNOME...

Iade

Gnome Style Guidelines

Hi,

I think the coloring of the Widget is not compatible with the Guidelines for Gnome. It looks bad when only the mouse and keyboard icon are colored. Would it eventually be possible to show the icon in white, like other bar icons, and only make it red when the battery is low? Another idea I had was to show the battry by having the icon filling from the bottom with lighter white than the background of the icon to show a level like battery indicators do.

'Object St.Icon has been already disposed' exception every 30 second

Hi there,

Running Fedora 38 with Gnome 44, I'm seeing the following log statements every 30 seconds when browsing the users logs (e.g. journalctl -b).

apr 27 23:26:18 linux gnome-shell[2548]: Object St.Label (0x55ee00e6d530), has been already disposed — impossible to set any property on it. This might be caused by the object having been destroyed from C code using something such as destroy(), dispose(), or remove() vfuncs.
apr 27 23:26:18 linux gnome-shell[2548]: == Stack trace for context 0x55ee00a40de0 ==
apr 27 23:26:18 linux gnome-shell[2548]: #0   7ffdacf5eb90 b   /home/user/.local/share/gnome-shell/extensions/[email protected]/wirelesshid.js:171 (39adebe11e70 @ 76)
apr 27 23:26:18 linux gnome-shell[2548]: #1   7ffdacf5ec50 b   /home/user/.local/share/gnome-shell/extensions/[email protected]/wirelesshid.js:196 (39adebe11f60 @ 17)
apr 27 23:26:18 linux gnome-shell[2548]: #2   7ffdacf5ed00 b   /home/user/.local/share/gnome-shell/extensions/[email protected]/wirelesshid.js:192 (39adebe11ec0 @ 195)
apr 27 23:26:18 linux gnome-shell[2548]: #3   55ee05a23848 i   self-hosted:1121 (21f65d9a0dd0 @ 501)
apr 27 23:26:18 linux gnome-shell[2548]: == Stack trace for context 0x55ee00a40de0 ==
apr 27 23:26:18 linux gnome-shell[2548]: #0   7ffdacf5ec50 b   /home/user/.local/share/gnome-shell/extensions/[email protected]/wirelesshid.js:199 (39adebe11f60 @ 64)
apr 27 23:26:18 linux gnome-shell[2548]: #1   7ffdacf5ed00 b   /home/user/.local/share/gnome-shell/extensions/[email protected]/wirelesshid.js:192 (39adebe11ec0 @ 195)
apr 27 23:26:18 linux gnome-shell[2548]: #2   55ee05a23848 i   self-hosted:1121 (21f65d9a0dd0 @ 501)
apr 27 23:26:18 linux gnome-shell[2548]: clutter_text_get_editable: assertion 'CLUTTER_IS_TEXT (self)' failed
apr 27 23:26:18 linux gnome-shell[2548]: clutter_text_get_text: assertion 'CLUTTER_IS_TEXT (self)' failed
apr 27 23:26:18 linux gnome-shell[2548]: clutter_text_set_text: assertion 'CLUTTER_IS_TEXT (self)' failed
apr 27 23:26:18 linux gnome-shell[2548]: Object St.Icon (0x55ee028e6440), has been already disposed — impossible to access it. This might be caused by the object having been destroyed from C code using something such as destroy(), dispose(), or remove() vfuncs.

apr 27 23:26:48 linux gnome-shell[2548]: Object St.Label (0x55ee00e6d530), has been already disposed — impossible to set any property on it. This might be caused by the object having been destroyed from C code using something such as destroy(), dispose(), or remove() vfuncs.
apr 27 23:26:48 linux gnome-shell[2548]: == Stack trace for context 0x55ee00a40de0 ==
apr 27 23:26:48 linux gnome-shell[2548]: #0   55ee05a23a58 i   /home/user/.local/share/gnome-shell/extensions/[email protected]/wirelesshid.js:171 (39adebe11e70 @ 76)
apr 27 23:26:48 linux gnome-shell[2548]: #1   55ee05a239c0 i   /home/user/.local/share/gnome-shell/extensions/[email protected]/wirelesshid.js:196 (39adebe11f60 @ 17)
apr 27 23:26:48 linux gnome-shell[2548]: #2   55ee05a23918 i   /home/user/.local/share/gnome-shell/extensions/[email protected]/wirelesshid.js:192 (39adebe11ec0 @ 195)
apr 27 23:26:48 linux gnome-shell[2548]: #3   55ee05a23848 i   self-hosted:1121 (21f65d9a0dd0 @ 501)
apr 27 23:26:48 linux gnome-shell[2548]: == Stack trace for context 0x55ee00a40de0 ==
apr 27 23:26:48 linux gnome-shell[2548]: #0   55ee05a239c0 i   /home/user/.local/share/gnome-shell/extensions/[email protected]/wirelesshid.js:199 (39adebe11f60 @ 64)
apr 27 23:26:48 linux gnome-shell[2548]: #1   55ee05a23918 i   /home/user/.local/share/gnome-shell/extensions/[email protected]/wirelesshid.js:192 (39adebe11ec0 @ 195)
apr 27 23:26:48 linux gnome-shell[2548]: #2   55ee05a23848 i   self-hosted:1121 (21f65d9a0dd0 @ 501)
apr 27 23:26:48 linux gnome-shell[2548]: clutter_text_get_editable: assertion 'CLUTTER_IS_TEXT (self)' failed
apr 27 23:26:48 linux gnome-shell[2548]: clutter_text_get_text: assertion 'CLUTTER_IS_TEXT (self)' failed
apr 27 23:26:48 linux gnome-shell[2548]: clutter_text_set_text: assertion 'CLUTTER_IS_TEXT (self)' failed
apr 27 23:26:48 linux gnome-shell[2548]: Object St.Icon (0x55ee028e6440), has been already disposed — impossible to access it. This might be caused by the object having been destroyed from C code using something such as destroy(), dispose(), or remove() vfuncs.

(Sample with two occasions)

Your extension does seem to work properly, regardless the log statements. That said, would be nice if you could take a look to at least lighten the logs.

Tray indicator persists even when the device has been unplugged or disconnected.

Bug is still happening as of Gnome 43.2 with the lastest version of the extension. (I don't know how to check version but I'm sure it's the latest). Re-installing didn't help.

As title suggested. Can be removed by turning the extension on and off again.

Tray indicator functions normally when device is connected. However just refuses to go away afterward. Please fix.

Logitech HID++/Bluetooth devices are detected twice with different info

As described here https://gitlab.freedesktop.org/upower/upower/-/issues/166 some devices are detected twice by upower due to an underlying kernel behavior related to some HID++ logitech driver, this therefore makes it so those devices are displayed twice in wireless-hid

The solution proposed to upower was to deduplicate those devices using the device serial number, but seems like for now that proposal was rejected. I believe we could do that deduplication instead in the gnome-shell extension.

I could send a PR with this, would such a contribution be accepted?

Allow for custom device specific threshold

My mouse has been at 10% for over a month now (maybe two), and I consistently get warned how low the battery is.
Apparently some devices take a lot longer to die than others. I don't know how hard it would be to implement, but it would be awesome if there was a way to set a custom threshold based on device. Maybe I need an alert at 5%? Who knows?

Using the warning-level from UPower in case of devices that don't report it, leads to lack of reporting low and critical states in extension

Device: /org/freedesktop/UPower/devices/headset_dev_38_18_4C_D4_C6_50
  native-path:          /org/bluez/hci0/dev_38_18_4C_D4_C6_50
  model:                WH-1000XM3
  serial:               38:18:4C:D4:C6:50
  power supply:         no
  updated:              pią, 9 sie 2024, 06:55:40 (12 seconds ago)
  has history:          yes
  has statistics:       no
  headset
    warning-level:       none
    percentage:          10%
    icon-name:          'battery-missing-symbolic'

This headset does not report warning-level so if (this.device.warning_level === UPowerGlib.DeviceLevel.CRITICAL) { won't work.

I assume there must be more devices that don't report warning-level even if they know percentage, so in such case I think the best solution would be to add toggle and two value inputs in config of extension for ignoring warning-level of devices and percentages for battery to be considered in low or critical state. By default toggle set to false, so that it follows warning-level from upower and in rare cases like mine user would be able to set it to true and set own thresholds.

I obviously would have preferred to interfere with upower and add behavior of setting warning-level for my headset, but I didn't find any materials how to do it, and only information I have found pointed to it being not possible. Hence the issue report. For now I just modify js file, but "fixing" it with each update is tedious.

Different values for icon colours

Currently, we have orange for low battery at 30%, and red for critical at 10%, however UPower uses 20% and 5% respectively, so the extension changing colours and the notifications sent by the shell don't line up.

@vchlum If you'd rather the values line up with upstream, I'd be happy to change it, otherwise I'll leave it and close this :)

[Feature Request] Allow blacklisting device [low priority]

i recently bought a mx master 3s and use solaar to have the battery indicator when using the usb bolt dongle . having a way to blacklist device would allow me to not have 2 battery indicator for the device when connected by bluetooth

when using the usb dongle
Screenshot from 2022-09-20 18-48-52
when using bluetooth
Screenshot from 2022-09-20 18-50-08

Extension not completely cleaning up after being disabled

I've noticed the following errors in the logs recently:

Jun 03 15:14:41 snakeroot gnome-shell[8464]: Object St.Label (0x55b128808550), has been already disposed — impossible to set any property on it. This might be caused by the object having been destroyed from C code using something such as destroy(), dispose(), or remove() vfuncs.
Jun 03 15:14:41 snakeroot gnome-shell[8464]: == Stack trace for context 0x55b124cd8f00 ==
Jun 03 15:14:41 snakeroot gnome-shell[8464]: #0   55b12633de28 i   /home/ratus5/.local/share/gnome-shell/extensions/[email protected]/wirelesshid.js:171 (36c70e13d650 @ 76)
Jun 03 15:14:41 snakeroot gnome-shell[8464]: #1   55b12633dd90 i   /home/ratus5/.local/share/gnome-shell/extensions/[email protected]/wirelesshid.js:196 (36c70e185f60 @ 17)
Jun 03 15:14:41 snakeroot gnome-shell[8464]: #2   55b12633dce8 i   /home/ratus5/.local/share/gnome-shell/extensions/[email protected]/wirelesshid.js:192 (36c70e15af10 @ 195)
Jun 03 15:14:41 snakeroot gnome-shell[8464]: #3   7ffc9186c410 b   self-hosted:1121 (bf9a0373f60 @ 501)
Jun 03 15:14:41 snakeroot gnome-shell[8464]: == Stack trace for context 0x55b124cd8f00 ==
Jun 03 15:14:41 snakeroot gnome-shell[8464]: #0   55b12633dd90 i   /home/ratus5/.local/share/gnome-shell/extensions/[email protected]/wirelesshid.js:199 (36c70e185f60 @ 64)
Jun 03 15:14:41 snakeroot gnome-shell[8464]: #1   55b12633dce8 i   /home/ratus5/.local/share/gnome-shell/extensions/[email protected]/wirelesshid.js:192 (36c70e15af10 @ 195)
Jun 03 15:14:41 snakeroot gnome-shell[8464]: #2   7ffc9186c410 b   self-hosted:1121 (bf9a0373f60 @ 501)
Jun 03 15:14:41 snakeroot gnome-shell[8464]: clutter_text_get_editable: assertion 'CLUTTER_IS_TEXT (self)' failed
Jun 03 15:14:41 snakeroot gnome-shell[8464]: clutter_text_get_text: assertion 'CLUTTER_IS_TEXT (self)' failed
Jun 03 15:14:41 snakeroot gnome-shell[8464]: clutter_text_set_text: assertion 'CLUTTER_IS_TEXT (self)' failed
Jun 03 15:14:41 snakeroot gnome-shell[8464]: Object St.Icon (0x55b125f624e0), has been already disposed — impossible to access it. This might be caused by the object having been destroyed from C code using something such as destroy(), dispose(), or remove() vfuncs.

This only appears after the extension has been unloaded, and occurs exactly every 30 seconds after this happens. My guess is that this is the callback on the signal for UPower updating the battery information is still being called, as the extension hasn't unloaded properly. It then tries to update the label and icon, which no longer exist, as those have been cleaned up by the shell.

I'm running the latest git version, from a clean boot, in case it was a bug from the previous version carrying through until a reboot.

I tried sorting this myself, but I can't follow the logic the code uses to clean up, as I can't seem to understand when _onDestroy() would be called on the WirelessHID class. Perhaps it's not being called, and the function should also call clean() on each device?

Battery levels reported as -1%

on arch linux with the latest gnome packages installed since a few days ago the indicators always report -1% battery levels and keyboard icons. The hid devices are a keyboard and a mouse paired with the same logitech unifying receiver (in case it matters). Power levels are read correctly in the settings.
Screenshot from 2022-05-19 14-20-01
Screenshot from 2022-05-19 14-20-17

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.