site  contact  subhomenews

network-manager-applet patched for EasyOS

September 22, 2019 — BarryK

Yesterday was a coding marathon, until the wee small hours of this morning. I tackled problems with 'network-manager-applet', that prevented it from being integrated into EasyOS. The same problems apply to Puppy.

The EasyOS Pyro and Buster builds have a primitive text-mode GUI, named 'nmtui', which comes with the 'NetworkManager' package.

 The executable 'NetworkManager' is a daemon, that automatically manages network connectivity, doing stuff like automatically connecting when it detects an active network interface. The package also has 'nmtui' and 'nmcli', the former, as mentioned, is a GUI, and the latter is a CLI utility for configuring 'NetworkManager'.

There is a package named 'network-manager-applet', or 'network-manager-gnome'. It contains two GTK3 GUI applications named 'nm-applet' and 'nm-connection-editor', for managing 'NetworkManager'. The former is a tray applet, the latter is a standalone app.

Problem #1

This is the biggest problem, that prevented me from integrating 'network-manager-applet' into Easy. App 'nm-connection-editor' is mostly (but not completely) only for editing existing connections. It is weird, you can setup a wi-fi connection manually, but it lacks wi-fi scanning. On the other hand, 'nm-applet' does do all setup, including wi-fi scanning, but can only be launched by clicking on the icon in the system tray.

That's the big problem. I need to be able to bring up the full connection setup GUI standalone. It has to integrate with the "connect" icon on the desktop, and be able to co-exist with the older network connection methods (such as SNS).

I did of course google this issue, and found many people wanting to do the same thing, but told they can't.

Problem #2

When I was testing the 'nm-applet' tray app, I immediately noticed a shortcoming compared with the 'network_tray' app used previously in EasyOS (and a fork of network_tray is also used in the puppies). What 'network_tray' does is show you network traffic, indicating if data is flowing in or out. This is so convenient. Say you are downloading a file, and it is happening in the background, by looking at the 'network_tray' applet, you can see the incoming-traffic green light flashing, so you know it is still downloading. It is also nice to see whenever something is uploading!

Not so 'nm-applet'. The icon just sits there, unchanged. I personally found this to be quite unsettling, and a big turn-off.

nm-applet hacked

So what am I leading up to? I hacked the source code, and solved problems #1 and #2. What I have done is a bit primitive, but works. I can't get 'nm-applet' to run standalone, however, I can get it to popup, simulating either a left-click or right-click mouse button on the tray icon.

What you do it this:

# touch /tmp/easyos-trigger-nm-applet

...this will simulate a mouse left-button click. The created file will be immediately removed. Or this:

# touch /tmp/easyos-trigger-nm-applet-status

...this will simulate a right-button click. The file will be immediately removed.

I then imported icons and code from 'network_tray', that will replace those in 'nm-applet', and will flash green to show data traffic in or out. Yay! A snapshot is needed:

img1

...the menu shown is the result of a simulated left-click.

You can see that both 'nm-applet' and 'network_tray' are running, with identical icons. Note that in 'nm-applet' although I have substituted my own icons, other icons will display, for example when a connection is being established, 'nm-applet' displays a whirling animation. Once the connection is established, the icon will revert to my replacements.

Source patches

I have uploaded the patches and a build script. It is for 'network-manager-applet' version 1.8.20. I chose this particular version as that is what Debian Buster 10 uses. The source package and a tarball with the patches is here:

http://distro.ibiblio.org/easyos/source/alphabetical/n/

Next up, have a bit of work to do, to seamlessly integrate 'network-manager-applet' into Easy. It will be the same mechanisms as for Puppy, so this work will likely also be of great interest to the Puppy developers. 

Tags: easy