fflewddur / tophat

View CPU, memory, disk, and network activity in the GNOME top bar.
https://extensions.gnome.org/extension/5219/tophat/
GNU General Public License v3.0
347 stars 26 forks source link

Added option for bandwidth in bits instead of bytes. #31

Closed esalvati closed 2 years ago

esalvati commented 2 years ago

Keeping de default behavior unchanged, added the option to specify via lib/config.js bandwidth in bits per second.

fflewddur commented 2 years ago

Hi @esalvati , thanks for the contribution! I think this still needs different logic for the suffixes (K, M, G, etc.), since the values for these are in bytes (lines 277 - 279), so you're comparing bits against bytes with the bw variable.

esalvati commented 2 years ago

Hi @fflewddur. Thanks for the reply. In this case, it doesn't matter. For example, 2 Mbytes (2097152 bytes) would be shown as 2 MB/s with BANDWIDTH_IN_BITS as false or, if BANDWIDTH_IN_BITS is true, would be converted to 16 Mbits (16777216 bits) and shown as 16 Mb/s. The variable unit (B/b) will change accordingly.

fflewddur commented 2 years ago

Ah, you're right, sorry for the confusion. Thanks for the contribution!