This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Network monitor: bits vs bytes: it bites.

Tags: None
(comma "," separated)
User avatar
gamallw
Registered Member
Posts
20
Karma
0
OS
Hello,

My trusty network monitor is now (since I upgraded to the latest Kubuntu, but I assume it's a KDE change) showing traffic in (multiples of) bits per second instead of bytes per second, as it used to.

There is no option that I can see to revert this change. (Kvetching: I'd like to understand the thought process of the dev who woke up and just changed a unit into another without giving the user a choice. Perhaps in response to viewtopic.php?f=304&t=138801&p=371509&hilit=network+monitor+bits+bytes#p371509 ? It may come as a shock to said dev, but not everybody uses the same units, so such a change is guaranteed to annoy someone. Especially when going from the common unit, used for every file size in every GUI, to the less common one -- aside from connection speed I don't see much in bits. Let's not even get into Mega vs Mebi stuff. End Kvetching)

Since I do not enjoy having to mentally divide by 8 each time I glance at the monitor, I'd like to *at least* revert that on my computer. Is there a way ?
User avatar
Rog131
Registered Member
Posts
828
Karma
10
gamallw wrote:
...Since I do not enjoy having to mentally divide by 8 each time I glance at the monitor, I'd like to *at least* revert that on my computer. Is there a way ?


In the world of the FOSS everything is possible...


One way to do it - My Network Monitor:

Copy and rename /usr/share/plasma/plasmoids/org.kde.plasma.systemmonitor.net/ to $HOME/.local/share/plasma/plasmoids/org.kde.plasma.mysystemmonitor.net/

Note !
It is mysystemmonitor !

Image

Edit $HOME/.local/share/plasma/plasmoids/org.kde.plasma.mysystemmonitor.net/metadata.desktop

Sample file:
Code: Select all
[Desktop Entry]
Encoding=UTF-8
Name=My Network Monitor
Name[x-test]=xxMy Network Monitorxx

Comment=My network usage monitor
Comment[x-test]=xxMy network usage monitorxx

Type=Service
Icon=network-workgroup

X-KDE-ServiceTypes=Plasma/Applet

X-Plasma-API=declarativeappletscript
X-Plasma-MainScript=ui/net.qml
X-Plasma-StandAloneApp=true

X-Plasma-ConfigPlugins=solid-actions,device_automounter_kcm

X-KDE-PluginInfo-Author=Marco Martin
X-KDE-PluginInfo-Email=mart@kde.org
X-KDE-PluginInfo-Name=org.kde.plasma.mysystemmonitor.net
X-KDE-PluginInfo-Version=1.0
X-KDE-PluginInfo-Website=
X-KDE-PluginInfo-Category=System Information
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL-2.0+
X-KDE-FormFactors=tablet,mediacenter,desktop


Make same edits to the $HOME/.local/share/plasma/plasmoids/org.kde.plasma.mysystemmonitor.net/metadata.json or simply remove it.

Edit $HOME/.local/share/plasma/plasmoids/org.kde.plasma.mysystemmonitor.net/contents/ui/net.qml
Remove the formats:
Image
Image

After edit - $HOME/.local/share/plasma/plasmoids/org.kde.plasma.mysystemmonitor.net/contents/ui/net.qml:
Code: Select all
/*
 *   Copyright 2015 Marco Martin <mart@kde.org>
 *
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU Library General Public License as
 *   published by the Free Software Foundation; either version 2 or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details
 *
 *   You should have received a copy of the GNU Library General Public
 *   License along with this program; if not, write to the
 *   Free Software Foundation, Inc.,
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

import QtQuick 2.0
import QtQuick.Layouts 1.1
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.kquickcontrolsaddons 2.0 as KQuickAddons

Applet {
    id: root

    onSourceAdded: {
        if (source.indexOf("network/interfaces/lo/") !== -1) {
            return;
        }
        var match = source.match(/^network\/interfaces\/(\w+)\/transmitter\/data$/);
        if (match) {
            var rxSource = "network/interfaces/" + match[1] + "/receiver/data";
            root.addSource(source, match[1], rxSource, match[1]);
        }
    }



    delegate: DoublePlotter {}
}


Save the file.

Now there should be two Network Monitors available:

Image
Image

Yours and the official.


Same kind of - My Digital Clock: viewtopic.php?f=17&t=134970&p=361132#p361132
User avatar
gamallw
Registered Member
Posts
20
Karma
0
OS
Thank you, kind sir; it works, and the operation was quite painless :)

Had I been more enterprising, I could have found the qml file (well, I kinda botched my 'find' yesterday, but in principle...) and reversed vlr's diff, having seen it on GitHub, but I doubt I'd have had the wherewithal and patience to find out where to place a local copy (or even guessed it was possible, for the plasma/plasmoids dirs didn't exist in my .local.) and I wouldn't have dared to modify the global version, for fear of breaking stuff. That might come in handy the next time a plasmoid misbehaves.

While we're at it, let's note that vlr's code could also be adapted to B, KB, MB and B, KiB, MiB displays, simply by playing on the 1024 vs 1000 and 8 vs 1 constants.

I'll contact the author to see if they're willing to make those an option. Shouldn't be too hard for someone who already knows where stuff is in QML. I'd do it myself if I could just find out how to add two checkboxes or option boxes to the plasmoid's options dialog, and get their values. I glanced at https://techbase.kde.org/Development/Tutorials/Plasma5 but didn't see anything about that.

Anyway, thanks again !
User avatar
gamallw
Registered Member
Posts
20
Karma
0
OS
Hum... whenever I try to remove the old network monitor (long click, remove), after a few seconds I'm treated to a black screen for a half second before plasma restarts, and the old monitor is back in the upper-left corner of the screen. Strange.

(edit: also happens with right-click / remove)

edit: seems to happen whenever I remove any widget.
User avatar
compatico
Registered Member
Posts
106
Karma
0
OS
gamallw wrote:Hum... whenever I try to remove the old network monitor (long click, remove), after a few seconds I'm treated to a black screen for a half second before plasma restarts, and the old monitor is back in the upper-left corner of the screen. Strange.
(edit: also happens with right-click / remove)
edit: seems to happen whenever I remove any widget.

Plasma should not restart because you remove a widget...I think maybe it's crashing and restarting so the widget is not actually removed?

Having said that, I was one of those who mentioned the monitor should be "bps" based as I prefer to see speed relative to my link and/or internet speed. But that's just me (and a few others I'm guessing due to the change).
???
Also something I've mentioned but haven't seen any response, is the text on the widgets should be black bordered so it's readable with bright backgrounds. For instance, you max out your upload on Network Monitor and the green graphics fill most of the widget, but you can't read the speed because the white text is lost in the green graphics. I think that's more important than bps/Bps. But that's just me.
;D


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]