Coder Social home page Coder Social logo

vchlum / wireless-hid Goto Github PK

View Code? Open in Web Editor NEW
21.0 21.0 7.0 213 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.53% Shell 0.57% CSS 0.37% Makefile 5.53%
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

Watchers

 avatar  avatar  avatar

wireless-hid's Issues

[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?

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 :)

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.

[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 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

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?

[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.

'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.

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

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?

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.

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.