You are not logged in.

#1 2014-01-12 19:36:07

ajbibb
Member
Registered: 2012-02-12
Posts: 142

CMST - A Connman GUI front end with system tray icon

I've been working on a GUI front end for the connman daemon to include a system tray icon.  I think I've got the code into a condition where it may be usable for other people.  Right now the link will download a .tar.gz file containing the code and two executables.  The executable in the main directory is for x86_64 architecture, the one in the i686 directory is for that architecture.  If you wish to build it yourself make files are included in the archive.  No AUR package at the moment as that step seems premature if there is no interest in this program (it does afterall try to do the same things as the GTK front end).  The download link:

https://dl.dropboxusercontent.com/s/sw9 … Ui3rCT8d9g

Project files are located at: https://github.com/andrew-bibb/cmst
AUR: https://aur.archlinux.org/packages/cmst

This program is written using the QT libraries.  I'm afraid that QT was the only way I was going to be able to create the system tray icon and deal with the DBus stuff.  The QT dependency is limited to one package, not the entire QT install.  Dependencies are:

connman
qt5-base

I do have some screenshots at this link:
https://github.com/andrew-bibb/cmst/wiki/Screenshots

If anyone wants to try it out and provide feedback please have at it.



Postscript:
After hacking my way through the weeds of the QT DBus and Connman API documentation I finally gained enough insight to understand the connmanctl manpage.  Turns out that it is possible setup and login to a protected network access point using the connmanctl command line interface.  If you want a super light weight solution I've updated the Connman Wiki to explain how.

edit: revised project locations

Last edited by ajbibb (2015-03-01 23:37:33)

Offline

#2 2014-01-13 22:46:12

Diaz
Member
From: Portugal
Registered: 2008-04-16
Posts: 366

Re: CMST - A Connman GUI front end with system tray icon

I don't really have the time yet, but when I have i'll try to check your project. A gui for connman is something really needed and I can't understand how people are just ok with network Manager. Sometimes it just acts all weird, then I start the connman service and it acts all better. When I need I use one of the two gtk tray icon apps that exist in aur, but they are really lacking. It's better than nothing at least.

I was messing around I found this that may be useful: https://github.com/nemomobile/libconnman-qt
as it is a core lib used in nemo, that implies mer and I'm sure it is running in my Jolla phone, it seems to wrap somewhat the dbus calls, not that I've checked closely.

Anyway, for me, things related to connman are cool, i'm tired of depending on networkmanager big_smile.

Last edited by Diaz (2014-01-13 22:47:16)

Offline

#3 2014-01-15 01:35:43

gothmog123
Member
Registered: 2012-10-31
Posts: 120

Re: CMST - A Connman GUI front end with system tray icon

ajbibb wrote:

Postscript:
After hacking my way through the weeds of the QT DBus and Connman API documentation I finally gained enough insight to understand the connmanctl manpage.  Turns out that it is possible setup and login to a protected network access point using the connmanctl command line interface.  If you want a super light weight solution I've updated the Connman Wiki to explain how.

Awesome! Connman is the best.

Offline

#4 2014-03-11 00:55:46

talonzx
Member
Registered: 2010-02-16
Posts: 7

Re: CMST - A Connman GUI front end with system tray icon

gonna test this out when i get home thanks

Offline

#5 2014-03-11 01:24:28

cris9288
Member
Registered: 2013-01-07
Posts: 348

Re: CMST - A Connman GUI front end with system tray icon

This is great! Thank you for working on it. Just one question: I would like to start the tray icon on startup (executed by .xinitrc). Is there a flag that I can pass to cmst to have it start up quietly, minimized in the tray? I know this is still very early, so it's not that big a deal.

Last edited by cris9288 (2014-03-11 01:25:29)

Offline

#6 2014-03-11 01:26:54

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,089
Website

Re: CMST - A Connman GUI front end with system tray icon

Hey there, this looks pretty nice. Have you given thought to hosting the source on something like GitHub so we can inspect it without downloading the whole tarball (and so that downloads can go through not-dropbox tongue)?

All the best,

-HG

Offline

#7 2014-03-11 12:18:47

ajbibb
Member
Registered: 2012-02-12
Posts: 142

Re: CMST - A Connman GUI front end with system tray icon

Currently there are no command line options with this program.  I think it might make more sense to save the state of the widgets at close and then start them up in the same state next boot.  I've done that in the past and it is very simple using the QSettings class.  If you think command line switch would be better I can put that in just as easily, so let me know.

You bring up a good point about starting up. I was originally only going to fire up the program when I need to connect to a new network, and truthfully since I've discovered how to use the command line interface for protected access points I now use that more than my own program.  I never really thought this part through, but I probably should work up a systemd unit for this.  I would think that would be the most appropriate way to start up   

I had originally planned on the system tray to be a key feature of the user interface, so much so that it is part of the program name (the ST).  As the coding progressed the tray became less and less important to me until it really ended up just being a place to minimize the dialog box to (I'm using i3-wm so it is either that or put it on the scratch pad).  I've looked at a couple of other tray icons, both in Linux and Windows, and while most display a bunch of information it seems to be stuff that I don't consider to be that useful.  Right now the system tray is kind of bare, so if you would like to see other things displayed there or have ideas for expanding the popup menu let me know.  If I can implement it I'll put it in. 

Regarding your note about being early, well not really.  There are more connman features that can be implemented, but right now I'm actually slightly past the point of where I can test.  A lot of the agent interface was written just by reading the connman API documents.  Two of the network types (enterprise wifi and hidden) were tested just by finding them around town and then seeing if my Agent responded the way it was supposed to.  I did not have permission to login to either network so I've not been able to complete the connection to see if it worked all the way through.  I'm willing to work on the additional features, for instance bluetooth, but I'll need a ton of input and feedback as I have no way of testing any of it.

Regarding GitHub; I was not going to do that until I had a reasonable expectation that this program might actually be useful to somebody.  It appears that we have crossed that threshold now so I'll try to set an account up, and also prepare a proper PKGBUILD to put in the AUR.

A-

Offline

#8 2014-03-11 18:37:34

cris9288
Member
Registered: 2013-01-07
Posts: 348

Re: CMST - A Connman GUI front end with system tray icon

ajbibb wrote:

Currently there are no command line options with this program.  I think it might make more sense to save the state of the widgets at close and then start them up in the same state next boot.  I've done that in the past and it is very simple using the QSettings class.  If you think command line switch would be better I can put that in just as easily, so let me know.

I think either implementation would provide that functionality just as adequately. If other things come up though that require command line switches, then I figure it wouldn't hurt to have one for opening the client minimized to the tray.

You bring up a good point about starting up. I was originally only going to fire up the program when I need to connect to a new network, and truthfully since I've discovered how to use the command line interface for protected access points I now use that more than my own program.  I never really thought this part through, but I probably should work up a systemd unit for this.  I would think that would be the most appropriate way to start up

Does cmst require an active X display to start up? Would a systemd unit require a user to have a systemd user session that starts X and their DM/DE/WM? I'm not sure how many users currently have that in place, but I don't think there's anything wrong with calling cmst & from .xinitrc (or from a DE/WM's startup mechanism) as most graphical applications are. CMST is just a frontend to the already running connmanctl service right?

I had originally planned on the system tray to be a key feature of the user interface, so much so that it is part of the program name (the ST).  As the coding progressed the tray became less and less important to me until it really ended up just being a place to minimize the dialog box to (I'm using i3-wm so it is either that or put it on the scratch pad).  I've looked at a couple of other tray icons, both in Linux and Windows, and while most display a bunch of information it seems to be stuff that I don't consider to be that useful.  Right now the system tray is kind of bare, so if you would like to see other things displayed there or have ideas for expanding the popup menu let me know.  If I can implement it I'll put it in. 


Regarding your note about being early, well not really.  There are more connman features that can be implemented, but right now I'm actually slightly past the point of where I can test.  A lot of the agent interface was written just by reading the connman API documents.  Two of the network types (enterprise wifi and hidden) were tested just by finding them around town and then seeing if my Agent responded the way it was supposed to.  I did not have permission to login to either network so I've not been able to complete the connection to see if it worked all the way through.  I'm willing to work on the additional features, for instance bluetooth, but I'll need a ton of input and feedback as I have no way of testing any of it.

Regarding GitHub; I was not going to do that until I had a reasonable expectation that this program might actually be useful to somebody.  It appears that we have crossed that threshold now so I'll try to set an account up, and also prepare a proper PKGBUILD to put in the AUR.

A-

Fair enough. I think the current feature set is pretty good. I'm sure other users will have suggestions. I've been able to connect to new and saved open and psk managed networks. The only thing that I've run into so far is being unable to connect to ieee8021x access points. When I select such a network and click connect, nothing happens. No output from the console or journalctl either. I can connect to it after creating a profile for it under /var/lib/connman, so I'm guessing that this feature isn't implemented by cmst yet. I'll continue to test and let you know if I run into any bugs. Thanks again for all your work!

Offline

#9 2014-03-12 00:03:14

ajbibb
Member
Registered: 2012-02-12
Posts: 142

Re: CMST - A Connman GUI front end with system tray icon

I just implemented the settings option, so the dialogs will start up in the same size, and at the same position as they were when you exited the program.  Not posting it yet as I see the point on the command line switches.  You are probably correct that has more ability to expand in the future, so I may pull the settings out and implement the switches.

Connman does not need X running, but this program does.  If starting from .xinitrc is no big deal I'll leave that alone for now.

On the ieee8021x access points, can you get on using the built in connman command line interface?  If a major error was received  from connman a dialog should have popped up, and there should also be a corresponding message in the system log.  The system log messages duplicate what appears in the dialogs so if you didn't see a dialog popup there is probably nothing in the system log.

This is where my inexperience in networking is going to start to show.  I'm not sure I've even heard of ieee8021x access points, or if I had it just went in one ear and out the other.  I'm going to spend some quality time with Mr. Google after I post this and see what they are about. 

My intention now is to have the GitHub, AUR and program updates ready round about this weekend.

[edit] fix up spelling error

Last edited by ajbibb (2014-03-12 00:04:39)

Offline

#10 2014-03-12 00:42:43

ajbibb
Member
Registered: 2012-02-12
Posts: 142

Re: CMST - A Connman GUI front end with system tray icon

OK, so what I've found is that "ieee8021x" is a possible return value for the security property in the connman service API.  It is possible you saw this in one of our windows as we query this property and display the results.  What is interesting is that there is no reference at all about it in the Agent API which is what is use to figure out what information to ask the user for to authenticate. The Agent receives a request from  connman, via the bus, to ask the user for information for authentication.  Part of the request is a listing of the information necessary from the user.  We process that request and present it in a dialog, so if the dialog is not coming up with any boxes open I've got to assume we never received the request from connman. 

I also found the following on the econnman program pages under the title Add support for ieee802.1x wireless networks.:

Connman does only support two phase authentication via config files. These config files reside in /var/lib/connman/ and are watched by the connman daemon. Unfortunatelly, connman does not support per session/user config files, so for simplicity's sake, we modify one in /var/lib/connman. With these changes, econnman manages a single file (/var/lib/connman/econnman.config), to which the user running it needs write access. By default the (empty) config file shipped with this packages has write permissions set for the group. Packagers might want to change the owner/group to root:users after installation or come around with a moresophisticated approach.

It sounds that the Enlightenment guys had to hack a fix for this.  Also found on a connman mailing list a comment that if you make any files /var/lib/connman user writeable that you've broken your security model.  I'll see what I can do with all of this, but i'm barely treading water right now.

A-

Offline

#11 2014-03-12 00:46:05

cris9288
Member
Registered: 2013-01-07
Posts: 348

Re: CMST - A Connman GUI front end with system tray icon

ajbibb wrote:

I just implemented the settings option, so the dialogs will start up in the same size, and at the same position as they were when you exited the program.  Not posting it yet as I see the point on the command line switches.  You are probably correct that has more ability to expand in the future, so I may pull the settings out and implement the switches.

Connman does not need X running, but this program does.  If starting from .xinitrc is no big deal I'll leave that alone for now.

On the ieee8021x access points, can you get on using the built in connman command line interface?  If a major error was received  from connman a dialog should have popped up, and there should also be a corresponding message in the system log.  The system log messages duplicate what appears in the dialogs so if you didn't see a dialog popup there is probably nothing in the system log.

This is where my inexperience in networking is going to start to show.  I'm not sure I've even heard of ieee8021x access points, or if I had it just went in one ear and out the other.  I'm going to spend some quality time with Mr. Google after I post this and see what they are about. 

My intention now is to have the GitHub, AUR and program updates ready round about this weekend.

[edit] fix up spelling error

I believe those networks are usually just referred to as wpa2 or wpa enterprise networks by other managers. They are usually deployed by universities, workplaces, etc. My technical knowledge on the subject is a little sparse, but they use a more complex authentication method (certificates, peap/mschapv2, tls, ccmp, etc plus a user name and password). Like I said, I didn't see any output from the console or the journal but I may have missed . I'll test it again when at work tomorrow. I'm fine just creating a profile for it, because as I mentioned cmst connects to the network fine once the configuration is in place.

Offline

#12 2014-03-13 21:25:38

frank604
Member
From: BC, Canada
Registered: 2011-04-20
Posts: 1,212

Re: CMST - A Connman GUI front end with system tray icon

I have an error running cmst. 

QXcbWindow: Unhandled client message: "_NET_SYSTEM_TRAY_S0" 
QXcbWindow: Unhandled client message: "_NET_SYSTEM_TRAY_S0" 

It constantly repeats this line.  All windows start flashing in and out.  I see the gui menu, but it also flashes.  This lasts for a few seconds until it registers my force close.  Am I doing something wrong?

I did:
tar -xvf cmst.tar.gz
./cmst

Offline

#13 2014-03-14 00:39:20

ajbibb
Member
Registered: 2012-02-12
Posts: 142

Re: CMST - A Connman GUI front end with system tray icon

That is an interesting one.  Two questions, are you positive you have qt5-base installed?  If so is there a system tray available in your DE/WM?  I am not sure I coded a check to actually verify the existence of a system tray, so I'm adding that to my list of things to do.

If you do have a system tray, and you do have qt5-base you could try building the code yourself.  It is fairly straight forward.  From the top level directory you extract from the tar.gz file,  type "qmake".  Once that completes (it will do so very quickly), type "make".  Qmake will look around your system to make sure all the dynamic libraries are sourced properly into the build, and "make" will then handle linking them in.  I've got an absolutely standard install, but still I think the proper way to distribute programs is to build locally from the source code, not provide executables as I did (and won't do again).

I've got the files moved over to Github and in the next two or three days I'm going to remove the Dropbox files and repost the links pointing to Github, and also put a proper PKGBUILD for the AUR. If you can wait a few days it may make more sense to wait for that.

Offline

#14 2014-03-14 01:34:04

frank604
Member
From: BC, Canada
Registered: 2011-04-20
Posts: 1,212

Re: CMST - A Connman GUI front end with system tray icon

Yes, qt5-base is installed.  I have a short video.
http://frankshin.com/files/videos/cmst1.mkv

Also, I am running just a WM, dwm with systray patched in.  All other systray icons do appear so far (dropbox, clipit, simplescreenrecorder, steam) so I'm not sure what is going on.  I also did qmake and then make.  Tried to run again and still the same error.

Hope this helps smile

Take your time, no rush.  I'm not in a hurry and thank you for this contribution and response.

Last edited by frank604 (2014-03-14 10:38:13)

Offline

#15 2014-03-14 08:54:22

57kev
Member
Registered: 2012-09-06
Posts: 3

Re: CMST - A Connman GUI front end with system tray icon

Hey ajbibb
thanks for this, works a treat for me.
I have it starting from a keybind in  I3, pop it up as needed.
cheers
Kev

Offline

#16 2014-03-14 12:31:21

ajbibb
Member
Registered: 2012-02-12
Posts: 142

Re: CMST - A Connman GUI front end with system tray icon

frank604: That information did help.  I don't know for sure, but I have a theory.  For QT the system tray implementation for X11 must be freedesktop.org compliant.  I've looked at the freedesktop specification and they define the following hints:   _NET_WM_NAME,   WM_CLASS,   _NET_WM_ICON, _NET_SYSTEM_TRAY_ORIENTATION.

I then went to suckless.org site to see if they state anywhere that their tray is freedesktop.org compliant.  Didn't find an answer to that one way or the other, but I did look at the code for their system tray and on line 459 found this hint:  _NET_SYSTEM_TRAY_S0. My theory is that the system tray may not be strictly freedesktop.org compliant, or perhaps it expands upon the basic compliance and QT can't handle the expansion.

I have revised the sources to check for a systemtray before we try to access it.  I want to temporarily remove the tray from my system so I can test the new pieces. Once I've tested it it will be part of the package I'm planning to put out this weekend (actually on github now, but as I said, untested).  I'm hoping that will let us work around the problem, but if QT recognizes the suckless.org tray, thereby passing my check, but chokes trying to put an icon there I may have to fall back to another commandline switch that will force the program to not use a systemtray.

Offline

#17 2014-03-15 16:20:33

ajbibb
Member
Registered: 2012-02-12
Posts: 142

Re: CMST - A Connman GUI front end with system tray icon

The first post has been updated to reflect the package updated, project files on Github, and a package in the AUR.

Modifications include:
Command line options now available (I removed the save settings code described above).  In addition to the standard -h (--help) and -v (--version) there are options for -d (--disable-tray-icon) which will force the tray icon to not be used, -m (--minimized) which will start the program minimized which generally means only the tray icon will be visible, and -l (--log-input-request) which will be mainly for debugging purposes.  This last one should translate the connman daemon input request to human readable form and save it in text file.  If you are interested in seeing what connman is doing on your dbus the log file location is: /tmp/cmst/input_request.log.  This file will only be created if --log-input-request is provided on the command line and then only if you are trying to make a connection where connman needs some information from you.  My intention is to use that if someone tries to connect and nothing appears to happen. 

I've also added code to look for a system tray before the program tries to access it.  If no tray is found a warning dialog will popup stating that, but the remainder of the program will still be functional.  The agent dialog has been expanded to have a field for SSID.  I originally thought this was optional and duplicated the Name field, but now I'm not so sure, so it has been added.

A-

Offline

#18 2014-03-15 19:20:37

frank604
Member
From: BC, Canada
Registered: 2011-04-20
Posts: 1,212

Re: CMST - A Connman GUI front end with system tray icon

@ajbibb,

Great job, it works with '-d' for me.  Also, if I am already connected to my router prior to running cmst, cmst doesn't detect this connection and shows as 'idle' state.  Not an issue, just thought I'd mention it.  This behavior is also seen in connman-ui-gtk.

Offline

#19 2014-03-16 05:49:32

gothmog123
Member
Registered: 2012-10-31
Posts: 120

Re: CMST - A Connman GUI front end with system tray icon

Has problems autostarting in cinnamon (complains it can't find tray). Starting it normally after boot - no problems.

Offline

#20 2014-03-17 01:10:44

ajbibb
Member
Registered: 2012-02-12
Posts: 142

Re: CMST - A Connman GUI front end with system tray icon

gothmog123: That is the way it is supposed to work.  When CMST starts up it looks for a system tray, and if it can't find a tray the program skips over creating a tray icon, and then pops up a message to let you know what it did.  Bad things happen if we try to create an icon on a tray that does not exist.  The fact that the program can be started normally after boot pretty much means that somehow CMST is starting up before your DE has a chance to create a system tray.

I'll add another command line option to allow you to specify a wait time before we try to create a system tray icon.  Assuming you can't change your start up order this should allow you to work around it.  I've got to think about how this will work with the other command line options, mostly --minimize.  I'll post here when the code is on Github, and I'll have it included in the next formal release, probably within two weeks.

Offline

#21 2014-03-18 01:48:51

gothmog123
Member
Registered: 2012-10-31
Posts: 120

Re: CMST - A Connman GUI front end with system tray icon

Thank you. A workaround right now is to just hack it into .xinitrc with sleep 20s and it's fine.

It's so cool to be talking to the developer of the app you're using. Can you make the tray icons use the system icon theme by any chance?

Last edited by gothmog123 (2014-03-18 04:29:26)

Offline

#22 2014-03-20 00:24:29

ajbibb
Member
Registered: 2012-02-12
Posts: 142

Re: CMST - A Connman GUI front end with system tray icon

I've posted to Github the revisions for a user specified wait time before the system tray starts up. The command line switch is -w (--wait-time).  Specify the delay time in seconds after the switch (example: -w 5 to wait 5 seconds).  Default is zero seconds.  It seems to work for me and if anyone wishes to download and test that would be great.

On using the system icon theme, I'm going to say maybe.  I've seen references in the QT docs about system icon themes, but have never looked much at them, so not really sure what is involved.  I do have another coding project going on right now so I'm not likely to look at an apperance issue like that for a bit.  Functional issues I'll try to jump on when I'm made aware of them.  I did add it to the "to do" list.  I like to keep these lists where I can find them so the "to do" list is actually coded into the program (end of the change log which you can get at from the last tab on the dialog).  Just trying to say I'm not going to forget about it, but probably won't happen real soon.

As an aside on icons, I use the Nuvola icon set mainly because it is quite complete and has a decent license.  The number of icons used in this program is quite modest, to be percise 8.  If there is somebody artistically inclined out there who is looking for eternal fame and glory and would like to take a crack at creating icons for the program please feel free to post here or drop me an email.  In addition to the 8 built in ones we could also use an application icon.

A-

Offline

#23 2014-03-21 15:58:29

frank604
Member
From: BC, Canada
Registered: 2011-04-20
Posts: 1,212

Re: CMST - A Connman GUI front end with system tray icon

I have an interesting offtopic story.  In my dream last night, I was at some college as a student but strangely was in a computer lab and long story short, the computer instructor was ajbibb!  It was so random and neat to meet a fellow arch user.  In the dream we figured out why the systray would bug out for me on dwm.  Well, here I am trying that solution out.

Offline

#24 2014-03-29 21:21:25

ajbibb
Member
Registered: 2012-02-12
Posts: 142

Re: CMST - A Connman GUI front end with system tray icon

An updated version with the new commandline option to delay the systemtray startup a specified number of seconds is in the AUR.

Offline

#25 2014-03-30 20:57:12

ajbibb
Member
Registered: 2012-02-12
Posts: 142

Re: CMST - A Connman GUI front end with system tray icon

To gothmog123 (and anybody else interested):

I just posted up to GitHub the code to try and use a system icon theme if one exists.  New command line option -i (--icon-theme) should enable it.  A couple of things to note.  I have no system icon theme on my system so my testing is very limited.  If you enable the option and you have no system theme, or you have a theme and the icon needed is not available it will fall back to my hard coded ones.  If you want a different icon for anything let me know, I pretty much just picked them based on a text description at freedesktop.org

These are not in the official release packages, but are in the current GitHub repository.  You'll need to download the .tar.gz file and build it to test.  Since I don't have a system icon theme I would appreciate it if someone who does could download, build and test.

thanks
A-

Offline

Board footer

Powered by FluxBB