# net-misc/DHCPCD-UI

## charles17

 *UberLord https://forums.gentoo.org/viewtopic-p-7617676.html#7617676 wrote:*   

> Done.
> 
> Now, if someone could create a dhcpcd-ui project page as I suck @ wiki text 
> 
> It has a GTK+ front-end, the QT port is almost complete and has an applet just for systemd so applications can depend on dhcpcd saying "network ready".
> ...

 Could we plase get an ebuild of the development version.  I don't want DBus, but once I have a chance to test dhcpcd-ui without DBus I would create the requested wiki page.

----------

## UberLord

Best to file a bug for it. dev's don't generally look here  :Smile: 

----------

## charles17

Done.

----------

## UberLord

New ebuild for dhcpcd-ui-0.7.1 posted on the bug.

----------

## charles17

As version net-misc/dhcpcd-ui-0.7.4 is now in portage. Some questions about it.

As it seems not possible to compile with the icons USE flag disabled, why does it have this USE flag at all?

When compiled with qt4 then Preferences in the tray menu is greyed out and unfunctional as shown here http://i.imgur.com/BeVcCyZ.png

Am I missing something in qt4 setup?  How to make it work?  With gtk it's normal.Last edited by charles17 on Tue Nov 11, 2014 9:23 am; edited 2 times in total

----------

## UberLord

 *charles17 wrote:*   

> As version net-misc/dhcpcd-ui-0.7.4 is now in portage.  Some questions about it.
> 
> As it seems not possible to compile with the icons USE flag disabled, why does it have this USE flag at all?

 

I queried that. A gentoo dev wanted that.

Icons are only needed for  GTK and QT builds - when building dhcpcd-online tool no icons are needed.

 *Quote:*   

> 
> 
> When compiled with qt4 then Preferences in the tray menu is greyed out and unfunctional as shown here http://i.imgur.com/BeVcCyZ.png
> 
> Am I missing something in qt4 setup?  How to make it work?  With gtk it's normal.

 

Ah, that's odd.

If it's greyed out then it means that it cannot communicate either with dhcpcd privileged socket.

So in theory it should be greyed out in the GTK version as well (the code path they use to work it out should be the same)

----------

## charles17

 *UberLord wrote:*   

> Icons are only needed for  GTK and QT builds - when building dhcpcd-online tool no icons are needed.

 I've tried compiling without gtk and qt4 but no luck http://i.imgur.com/RsvrWpJ.png

Should it be possible at all?

----------

## UberLord

I would say that's a bug with the ebuild.

----------

## charles17

https://bugs.gentoo.org/show_bug.cgi?id=528904

Edit:

What does this QA notice try telling us? http://i.imgur.com/Y12e66J.png

 *Quote:*   

>  QA Notice: This package installs one or more .desktop files that do not pass validation.

 

----------

## UberLord

It's telling is that Gentoo QA is out of date with regards to Cinnamon desktop entries.

----------

## charles17

 *UberLord wrote:*   

> It's telling is that Gentoo QA is out of date with regards to Cinnamon desktop entries.

 Ok, that's another story.

I still have the authorization problem https://529020.bugs.gentoo.org/attachment.cgi?id=389164 although my user is in wheel and the socket has rw for that group

```
$ groups

wheel uucp audio cdrom dialout video games cdrw usb users portage scanner charles17 plugdev
```

```
$ ls -al /run/dhcpcd.sock 

srw-rw---- 1 root wheel 0 Nov 13 08:33 /run/dhcpcd.sock
```

Authorization for wpa_supplicant and dhcpcd config files are the same. But wpa_gui can write to its file and dhcpcd-gtk still shows "Permission denied" https://529020.bugs.gentoo.org/attachment.cgi?id=389164 .

```
$ ls -al /etc/wpa_supplicant/wpa_supplicant.conf /etc/dhcpcd.conf 

-rw-r--r-- 1 root root 1246 Nov 13 08:29 /etc/dhcpcd.conf

-rw-r--r-- 1 root root  791 Nov 11 13:45 /etc/wpa_supplicant/wpa_supplicant.conf
```

How to get rid of "Permission denied"?

----------

## UberLord

The difference is that wpa_supplicant writes to the configuration from itself, so it has root access.

dhcpcd-gtk however, writes directly to dhcpcd.conf instead of getting dhcpcd to do it, so you, the user, needs write permission.

```
chgrp wheel /etc/dhcpcd.conf

chmod g+w /etc/dhcpcd.conf
```

----------

## charles17

Already copied to the wiki https://wiki.gentoo.org/wiki/Network_management_using_DHCPCD/Dhcpcd-ui

Left click on the system tray icon shows me the available APs https://wiki.gentoo.org/images/e/e7/Selection.png

Each time I try to select one of them or to switch to another I am prompted for the password aka psk.

How could I avoid this for APs that already have their psk in wpa_supplicant.conf?

----------

## RazielFMX

Something is odd here...

```

# emerge -pv net-misc/dhcpcd-ui

These are the packages that would be merged, in order:

Calculating dependencies -

!!! Problem resolving dependencies for net-misc/dhcpcd-ui

... done!

!!! The ebuild selected to satisfy "net-misc/dhcpcd-ui" has unmet requirements.

- net-misc/dhcpcd-ui-0.7.4::gentoo USE="gtk icons libnotify qt4 -debug -gtk3" ABI_X86="64"

  The following REQUIRED_USE flag constraints are unsatisfied:

    at-most-one-of ( gtk gtk3 qt4 )

  The above constraints are a subset of the following complete expression:

    at-most-one-of ( gtk gtk3 qt4 ) gtk3? ( !gtk ) gtk? ( !gtk3 ) icons? ( any-of ( gtk gtk3 qt4 ) )

```

The USE flags do not match reality:

```
# grep dhcpcd /etc/portage/package.use 

net-misc/dhcpcd -gtk -gtk3
```

Yet it still insists on bringing in gtk alongside qt4.

----------

## UberLord

 *charles17 wrote:*   

> Each time I try to select one of them or to switch to another I am prompted for the password aka psk.
> 
> How could I avoid this for APs that already have their psk in wpa_supplicant.conf?

 

Currently you can't.

Maybe future versions will grow a forget option to avoid this.

----------

## charles17

So presently we can use it as a nice additional monitor showing which interface is connected and the current IP address. https://wiki.gentoo.org/images/f/f7/Dhcpcd-ui_status.png

It can write network sections to wpa_supplicant.conf and details for static IP address to dhcpcd.conf.

Caution is still needed to not overwrite existing items.  Before new entries are written to wpa_supplicant.conf or to dhcpcd.conf or existing entries are changed we should have the possibility to abort or to save.

I really like this direct access more than first opening wpa_gui, then clicking "Manage Networks".

----------

## UberLord

 *RazielFMX wrote:*   

> Something is odd here...
> 
> Yet it still insists on bringing in gtk alongside qt4.

 

Please file Gentoo bugs on this.

----------

## UberLord

 *charles17 wrote:*   

> So presently we can use it as a nice additional monitor showing which interface is connected and the current IP address. https://wiki.gentoo.org/images/f/f7/Dhcpcd-ui_status.png
> 
> It can write network sections to wpa_supplicant.conf and details for static IP address to dhcpcd.conf.
> 
> Caution is still needed to not overwrite existing items.  Before new entries are written to wpa_supplicant.conf or to dhcpcd.conf or existing entries are changed we should have the possibility to abort or to save.
> ...

 

Pretty much it.

Why not add section on the wiki for feature requests so I don't loose track of them.

Or better yet, append to the upstream wiki - http://roy.marples.name/projects/dhcpcd-ui/wiki?name=todo

You'll need to login as anonymous to append to the page.

----------

## charles17

Ok, I'll try extending the todo list.

Another question: Why in dhcpcd-gtk is the "IP Address:" line greyed out? http://i.imgur.com/jJgdvF0.png

In dhcpcd-qt it's functional.

----------

## UberLord

Looks like a bug.

----------

## charles17

Gentoo bug or upstream?

----------

## UberLord

Upstream.

I should try and fix it I guess  :Smile: 

----------

## charles17

Another difference between dhcpcd-qt and dhcpcd-gtk, is this by design or also from the bug?

Qt gui shows wlan and ethernet http://i.imgur.com/4pQpIkZ.png

Ethernet not listed by gtk gui only http://i.imgur.com/a4FYgW5.png

----------

## UberLord

Just different UI facets.

I'll make them more similar  :Smile: 

----------

## UberLord

 *charles17 wrote:*   

> Ok, I'll try extending the todo list.
> 
> Another question: Why in dhcpcd-gtk is the "IP Address:" line greyed out? http://i.imgur.com/jJgdvF0.png
> 
> In dhcpcd-qt it's functional.

 

I had a look at it this morning, but it looked fine to me?

Maybe fixed in the next release.

----------

## charles17

 *UberLord wrote:*   

> I had a look at it this morning, but it looked fine to me?

 On "Configure interface" it looks ok for me too.  The incident for me is on "Configure ssid".  Did you check this also?

----------

## UberLord

Good catch, fixed here.

----------

## UberLord

 *charles17 wrote:*   

> Another difference between dhcpcd-qt and dhcpcd-gtk, is this by design or also from the bug?
> 
> Qt gui shows wlan and ethernet http://i.imgur.com/4pQpIkZ.png
> 
> Ethernet not listed by gtk gui only http://i.imgur.com/a4FYgW5.png

 

And this is also fixed here

----------

## charles17

Just tried the live 9999.ebuild from https://github.com/tokiclover/bar-overlay/tree/master/net-misc/dhcpcd-ui and running into unknown repository problems *Quote:*   

> # emerge -avt =net-misc/dhcpcd-ui-9999

 

```
These are the packages that would be merged, in reverse order:

Calculating dependencies  .... done!

[ebuild     U *] net-misc/dhcpcd-ui-9999::bar [0.7.4::gentoo] USE="gtk -debug -gtk3 -icons% -libnotify -qt4" 0 kB

Total: 1 package (1 upgrade), Size of downloads: 0 kB

Would you like to merge these packages? [Yes/No] 

>>> Verifying ebuild manifests

>>> Emerging (1 of 1) net-misc/dhcpcd-ui-9999 from bar

>>> Unpacking source...

unknown repository: 

 * ERROR: net-misc/dhcpcd-ui-9999::bar failed (unpack phase):

 *   (no error message)

 * 

 * Call stack:

 *     ebuild.sh, line  93:  Called src_unpack

 *   environment, line 1916:  Called die

 * The specific snippet of code:

 *               fossil clone "${FOSSIL_URI}" "${repo}" || die;

 * 

 * If you need support, post the output of `emerge --info '=net-misc/dhcpcd-ui-9999::bar'`,

 * the complete build log and the output of `emerge -pqv '=net-misc/dhcpcd-ui-9999::bar'`.

 * The complete build log is located at '/var/tmp/portage/net-misc/dhcpcd-ui-9999/temp/build.log'.

 * The ebuild environment file is located at '/var/tmp/portage/net-misc/dhcpcd-ui-9999/temp/environment'.

 * Working directory: '/var/tmp/portage/net-misc/dhcpcd-ui-9999/work'

 * S: '/var/tmp/portage/net-misc/dhcpcd-ui-9999/work/dhcpcd-ui-9999'

>>> Failed to emerge net-misc/dhcpcd-ui-9999, Log file:

>>>  '/var/tmp/portage/net-misc/dhcpcd-ui-9999/temp/build.log'
```

----------

## UberLord

The repository is fine for me.

Try removing the cached repository from portage for a fresh copy. I don't know off hand where it's stored though.

----------

## charles17

I can emerge version 0.7.4 from that repository, no problem *Quote:*   

> # emerge -avt =net-misc/dhcpcd-ui-0.7.4::bar

 

But the 9999.ebuild fails with that message regarding "unknown repository: "

----------

## UberLord

When I meant repository I meant mine, not the overlay  :Smile: 

Basically the 9999 ebuild works by creating a local fossil repository and syncing it with my upstream master.

You need to find this and delete it.

The ebuld has this code

```
   local distdir="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}"/fossil-src

local repo="${distdir}"/${PN}.fossil

```

So it might be /usr/portage/distfiles/fossil-src - find and delete that folder and re-try.

----------

## charles17

All deleted.  Another emerge  *Quote:*   

> # emerge -avt =net-misc/dhcpcd-ui-9999::bar

 only creates an empty 'fossil' sub directory and fails again *Quote:*   

> $ ls -al /usr/portage/distfiles/fossil-src/fossil/
> 
> total 0
> 
> drwxr-sr-x 2 portage portage 48 Dec  2 17:16 .
> ...

 

----------

## UberLord

Looks like an error your side somewhere, maybe an issue trying to talk to my server.

Does this work?

```

cd /tmp

mkdir fossil-test

cd fossil-test

fossil clone http://roy.marples.name/projects/dhcpcd-ui dhcpcd-ui.fossil

mkdir src

cd src

fossil open ../dhcpcd-ui.fossil
```

----------

## charles17

Yep, that works.  So I might have some misconfiguration?

----------

## UberLord

Don't know sorry.

Could be an issue with the ebuild, which I don't use myself. Try taking it upstream.

----------

## charles17

Now as the live ebuild got fixed I could emerge dhcpcd-ui from the fossil.  It pulled in gnome-base/librsvg, as the first gnome package on this machine.

With dhcpcd-ui (so far testing with the gtk ui) I get the alphabetically ordered SSIDs from last scan and I can switch between the SSIDs.

But it always prompts for psk even when psk is already stored in wpa_supplicant.conf.  I'd rather like it to prompt for psk only when needed.

----------

## UberLord

You can just hit the enter key or press OK.

You always get the dialogue as you may want to change the password.

----------

## charles17

Ok. Another question is about the prefs window.  Here it always starts partly hidden behind the lxpanel: http://i.imgur.com/QCzVqZy.png

How could this be adjusted?

----------

## UberLord

Unsure.

I just ask the window to popup where the mouse is.

The Window Manager is responsible for placing it so that it's entirely visible.

On my NetBSD system I use lxpanel-0.5.10 and OpenBox-3.5.2 and the preferences dialog is positioned perfectly by both dhcpcd-gtk and dhcpcd-qt.

On my Linux System I use KDE-4.something and again both are positioned perfectly.

----------

## UberLord

emerge the 9999 ebuild to get sexy wireless signal strength icons in the system tray now.

----------

## charles17

 *UberLord wrote:*   

> I just ask the window to popup where the mouse is.
> 
> The Window Manager is responsible for placing it so that it's entirely visible.

 So I have to check Fluxbox' understanding of positioning the windows.

Regarding the status display https://wiki.gentoo.org/images/f/f7/Dhcpcd-ui_status.png, how do you think about appending the SSID to the first line? »wlp8s0: Associated with Fritz!Box Guest«

Thanks for the icons improvement!!

----------

## UberLord

The SSID is supposed to be shown there.

The fact it's absent I believe is an error in the Linux kernel.

I have seen this myself from time to time where the kernel says to dhcpcd "I have associated" and a subsequent call from dhcpcd to the kernel to get the SSID associated to returns a blank string - for both nl80211 and WEXT interfaces.

Glad you like the new icons  :Smile: 

----------

## charles17

 *UberLord wrote:*   

> The SSID is supposed to be shown there.
> 
> The fact it's absent I believe is an error in the Linux kernel.

 But at the same time, wpa_supplicant (same screenshot) seems to have it.  Can't you get it from wpa_supplicant?

----------

## UberLord

I *could* do this, but that doesn't fix per SSID profiles in dhcpcd as dhcpcd doesn't directly talk to wpa_supplicant and probably never will. dhcpcd-{gtk,qt} talks to wpa_supplicant AND dhcpcd (in case you were wondering).

Also, I may grow support for non wpa_supplicant based solutions in the future, such as say OpenBSD where the WPA part is in the kernel.

----------

## charles17

 *charles17 wrote:*   

>  *UberLord wrote:*   I just ask the window to popup where the mouse is.
> 
> The Window Manager is responsible for placing it so that it's entirely visible. So I have to check Fluxbox' understanding of positioning the windows.

 

Problem is the same (windows behind panel) even without windows manager, just with startx, pure x11 and lxpanel.  

Also strange seems that windows started from dhcpcd-gtk icon do not have window handlers (left and right bottom corners) while windows started from other system tray icons do have them. 

On http://i.imgur.com/Bh7QedK.png windows on the left are opened from wpa_gui systray icon. Windows on the right are from dhcpcd-ui.

----------

## UberLord

 *charles17 wrote:*   

>  *charles17 wrote:*    *UberLord wrote:*   I just ask the window to popup where the mouse is.
> 
> The Window Manager is responsible for placing it so that it's entirely visible. So I have to check Fluxbox' understanding of positioning the windows. 
> 
> Problem is the same (windows behind panel) even without windows manager, just with startx, pure x11 and lxpanel.  

 

Chances are you're using twm. Try OpenBox?

 *Quote:*   

> 
> 
> Also strange seems that windows started from dhcpcd-gtk icon do not have window handlers (left and right bottom corners) while windows started from other system tray icons do have them. 
> 
> On http://i.imgur.com/Bh7QedK.png windows on the left are opened from wpa_gui systray icon. Windows on the right are from dhcpcd-ui.

 

Not strange.

My windows have the DIALOG hint, the wpa_gui ones do not. Dialogues are not normally resizable.

----------

## charles17

 *UberLord wrote:*   

> Chances are you're using twm. Try OpenBox?

 With Openbox (never tried before) window positions are ok.  So I agree the problem must be something with fluxbox.

----------

## charles17

 *UberLord wrote:*   

> Glad you like the new icons 

 

Just realized the system tray icon sometimes changes to the blinking state.  Users may wonder why it is blinking.  

How do you think about offering one more option here https://wiki.gentoo.org/images/6/67/Greyed_out.png displaying the status messages like http://i.imgur.com/WtjkrUh.png?

----------

## UberLord

It blinks to show something changed or renewed, like say a DHCP lease.

Status messages are displayed, you need to ensure it's been emerged with notify support and you have a notification display daemon running. Im not sure that LX starts the display daemon by default so you need to do that.

----------

## charles17

 *UberLord wrote:*   

> Status messages are displayed, you need to ensure it's been emerged with notify support and you have a notification display daemon running.

 Seems impossible to me to find a fulfilment for virtual/notification-daemon without dbus.  

But as a workaround I can easily have the wpa-gui flashing its notifications (without such notify stuff and dbus): http://i.imgur.com/Ejv0ZWy.png

----------

## UberLord

wpa_gui is written in Qt and used QSystemTrayIcon which can notify by itself

dhcpcd-gtk is written in GTK+ and for notification to work, a notify library is required as gtk does not support this natively

dhcpcd-qt is written in Qt and used QSystemTrayIcon which can notify by itself or optionally link to the KDE notification framework

 :Smile: 

So use dhcpcd-qt and you're golden.

----------

## charles17

 *UberLord wrote:*   

> dhcpcd-qt is written in Qt and used QSystemTrayIcon which can notify by itself or optionally link to the KDE notification framework
> 
> So use dhcpcd-qt and you're golden.

 Did you mean to use dhcpcd-qt without libnotify?  I've tried that, but not getting any notifications like I am getting from wpa_gui.  Only the icon changing.

Tried with openbox + lxpanel.

----------

## UberLord

Yes.

For the life of me I can't remember how to take screen grabs to show you how mine looks though.

Like the wpa_gui bubble though, just different text.

----------

## charles17

 *UberLord wrote:*   

> Yes.
> 
> For the life of me I can't remember how to take screen grabs to show you how mine looks though.

 For screenshots I am using *Quote:*   

> $ sleep 10 && import -window root /tmp/screenshot$(date +%F,%T).png

 

 *UberLord wrote:*   

> Like the wpa_gui bubble though, just different text.

 That's what I expected, but I don't get them. wpa_gui does, dhcpcd-qt doesn't.  

Is there any other dependencies I might be missing?

----------

## charles17

Coming back to this question ...

 *UberLord wrote:*   

> dhcpcd-qt is written in Qt and used QSystemTrayIcon which can notify by itself or optionally link to the KDE notification framework
> 
> So use dhcpcd-qt and you're golden.

 

It's still not working with dhcpcd-qt.  How could I debug the QSystemTrayIcon stuff?

----------

## UberLord

Good question. I'm not too sure and am going on holiday today so it maybe a while to reply with a proper answer.

----------

## charles17

It is not too urgent for me, no reason to spoil your holidays.

----------

## depontius

Please help my with my face-palm.

I'm attempting to bring up a new laptop using dhcpcd to control the networking.  So far it seems OK, except it's sitting here standalone, which really means that it properly detected that ethernet isn't plugged in.  There is an open wireless network available, but I would expect to need to do something to connect to that.

I've built the gtk (not gtk3) version of dhcpcd-ui, and when I try to start it, nothing happens.  I get:

```
** Message: Connecting ...

** Message: Status changed to opened

** Message: Connected to dhcpcd-6.9.0

** Message: Status changed to disconnected

** Message: eth0: Link is down

** Message: wlan0: Not associated
```

The prompt does not return - it's still executing.  I would expect all of this behavior, including the messages, but I also would have hoped that either some GUI would pop up or something would appear in the icewm systray.

I'm sure this is something really simple I've missed - below the level of the wiki.  Can anyone provide a clue-stick?  BTW, wpa_supplicant is installed, wheel and I are enabled, etc.

:

----------

## UberLord

I don't use IceWM, but I would expect an icon to appear in the system tray.

Generally you don't see an icon if dhcpcd-gtk cannot find an icon to load ..... I don't know why this should be the case for IceWM.

I don't actually use the ebuild myself .... maybe I should update my portage and try the ebuild out.

EDIT: But if there was no icon to be found, dhcpcd-ui should produce a message on the console as well.

----------

## depontius

 *UberLord wrote:*   

> I don't use IceWM, but I would expect an icon to appear in the system tray.
> 
> Generally you don't see an icon if dhcpcd-gtk cannot find an icon to load ..... I don't know why this should be the case for IceWM.
> 
> I don't actually use the ebuild myself .... maybe I should update my portage and try the ebuild out.
> ...

 

What icon is it looking for?  I would have expected a console message too, though perhaps there was an ignored message from the ebuild.

I went with gtk for simplicity, but it would be easy enough to use qt4.  Would that have an easier time, or is it still looking for some icon?  How do you expect icons to have been supplied?

----------

## UberLord

The icons should be supplied by the ebuild.

They should also be theme overrideable.

From memory, if the Qt SystemTray component cannot find an icon, it suffers the same fate, but it might be more noisy as well.

Try it and report back - I'm very busy right now in my personal life so can't be much help immediately.

----------

## depontius

I've gotten further.  I'm not at home, so this thing isn't plugged in for eth0.  I hadn't properly configured wpa_supplicant, which is why dhcpcd-ui failed to show.  Once I fixed that, it did.

However at this point I can't bring up the wireless using dhcpcd-ui - it doesn't show an available interfaces.  However I can start wpa_gui and bring wireless up wih that.  I can run, though it may not be the way I eventually want to be doing this.  I hope your being busy is fun, or at least fruitful.

----------

## charles17

Finally, commit 43f5c510450633d249f596fcc4f74255df76bb73 has removed all qt support from dhcpcd-ui ( bug 630638 ).  Would be very nice getting qt5 support for this package.

----------

## UberLord

 *charles17 wrote:*   

> Would be very nice getting qt5 support for this package.

 

I don't have a QT5 environment to develop in.

Nor do I have Enlightenment or a few others I'd like.

 :Sad: 

----------

## mir3x

I quickly ported dhcpcd to qt5 as exercise.

But how to use it ?

I tried normal gtk version from portage.

It says -

```
** Message: Connecting ...

** Message: Status changed to down

** (dhcpcd-gtk:19015): CRITICAL **: dhcpcd_open: No such file or directory

```

Similar I get in my qt version:

```
Connecting ...

Status changed to down

dhcpcd_open: Invalid argument

dhcpcd_open: No such file or directory

```

Another question, that kde notification should be replaced by qtdbus ?

[Moderator edit: added [code] tags to preserve output layout. -Hu]

----------

## charles17

 *mir3x wrote:*   

> I quickly ported dhcpcd to qt5 as exercise.

 Will you please provide us your qt5 coding?

 *mir3x wrote:*   

> But how to use it ?

 See the screenshots on https://wiki.gentoo.org/wiki/Dhcpcd-ui#Usage?

Select ssid from the list shown here and enter PSK only if needed.

 *mir3x wrote:*   

> I tried normal gtk version from portage.
> 
> It says - 
> 
> ** Message: Connecting ...
> ...

 

Please avoid dbus. In qt4 (I am still using that version) it works without dbus or other *kit cruft.

----------

## mir3x

https://github.com/mir3x/dhcpcd-ui

I updated only dhcpcd-qt.pro

and some *.cpp files.

Anyway should work 4 u.

For me its the same error, maybe I need relogin.

EDIT: still doesn;t work with gtk or qt.

I used 0.7.5-r1 version.

----------

## UberLord

dhcpcd needs to be running in master mode.

This means that the dhcpcd service needs to be added to a runlevel and no net.* service should start dhcpcd.

----------

## UberLord

Why didn't you fork my github mirror? https://github.com/rsmarples/dhcpcd-ui

If you fork it and reapply your changes to it then it makes it easier for me to review the changes as a whole.

I'm trying to get both a QT4 and QT5 env up so I can look at getting this working.

----------

## mir3x

 *UberLord wrote:*   

> Why didn't you fork my github mirror? https://github.com/rsmarples/dhcpcd-ui
> 
> 

 

https://github.com/mir3x/dhcpcd-ui-1 (doenst exist anymore)

I thought u r dead or abandoned project  :Very Happy: .

EDIT: oops, I need update it to your newest git

EDIT2: here is latest version 

https://github.com/mir3x/dhcpcd-ui

----------

## UberLord

Ah, that's better  :Smile: 

Those changes look straight forward. I just need to get a QT4 and QT5 envionments so I can verify it works on both, but I don't see any problems.

It's not a dead project, but it's a very slow project as it works well enough.

Ideally I should find time to work on dhcpcd-curses and start dhcpcd-efl, but I doubt that will happen soon.

If anyone can help out with that, it would be awesome  :Smile: 

----------

## charles17

 *mir3x wrote:*   

> EDIT2: here is latest version 
> 
> https://github.com/mir3x/dhcpcd-ui

 

Do you also have an ebuild for qt5 version? 

Here is last version before qt4 removal: https://github.com/gentoo/gentoo/blob/61b861acd7b49083dab687e133f30f3331cb7480/net-misc/dhcpcd-ui/dhcpcd-ui-0.7.5-r1.ebuild

----------

## UberLord

I merged your changes with a small cleanup here:

https://github.com/rsmarples/dhcpcd-ui/commit/a22159aa57ad5eb0bfb203529a16e2392daab49a

Thanks!

----------

## UberLord

Added some support for Qt-5.9 where I can set a custom icon for system stray notifications.

Seems to work well, some testing would be nice  :Smile: 

----------

## charles17

What are the dependencies for qt5?  I am just starting an ebuild, see https://github.com/gentoo/gentoo/compare/master...charIes17:dhcpcd-ui.

Any help for completing the ebuild is much appreciated.

----------

## fedeliallalinea

Can help?

```
$ ldd dhcpcd-qt | grep -i qt

        libQt5Widgets.so.5 => /usr/lib64/libQt5Widgets.so.5 (0x00007f5568e7b000)

        libQt5Gui.so.5 => /usr/lib64/libQt5Gui.so.5 (0x00007f55689c9000)

        libQt5Core.so.5 => /usr/lib64/libQt5Core.so.5 (0x00007f5568533000)
```

```
$ equery b /usr/lib64/libQt5Widgets.so.5

 * Searching for /usr/lib64/libQt5Widgets.so.5 ... 

dev-qt/qtwidgets-5.9.2 (/usr/lib64/libQt5Widgets.so.5.9.2)

dev-qt/qtwidgets-5.9.2 (/usr/lib64/libQt5Widgets.so.5 -> libQt5Widgets.so.5.9.2)

$ equery b /usr/lib64/libQt5Gui.so.5

 * Searching for /usr/lib64/libQt5Gui.so.5 ... 

dev-qt/qtgui-5.9.2 (/usr/lib64/libQt5Gui.so.5 -> libQt5Gui.so.5.9.2)

dev-qt/qtgui-5.9.2 (/usr/lib64/libQt5Gui.so.5.9.2)

$ equery b /usr/lib64/libQt5Core.so.5

 * Searching for /usr/lib64/libQt5Core.so.5 ... 

dev-qt/qtcore-5.9.2 (/usr/lib64/libQt5Core.so.5 -> libQt5Core.so.5.9.2)

dev-qt/qtcore-5.9.2 (/usr/lib64/libQt5Core.so.5.9.2)
```

----------

## charles17

 *fedeliallalinea wrote:*   

> Can help?

 

Thanks for your help.  Just added qtgui, qtcore and qtwidgets, see https://github.com/gentoo/gentoo/compare/master...charIes17:dhcpcd-ui#diff-9dfb4ad0513d7a4d04a7eb30eef96320R40  But dhcpcd-qt is not being built: 

```
/var/tmp/portage/net-misc/dhcpcd-ui-9999/image/

└── usr

    ├── bin

    │   ├── dhcpcd-curses

    │   └── dhcpcd-online

    ├── lib

    │   └── systemd

    │       └── system

    │           └── dhcpcd-wait-online.service

    └── share

        └── man

            └── man8

                ├── dhcpcd-curses.8.bz2

                └── dhcpcd-online.8.bz2

```

----------

## fedeliallalinea

You need also add sys-libs/ncurses[tinfo] as dependency (for curses ui).

I have another erro when compiling package:

```
cc  -Wl,-O1 -Wl,--as-needed -L../libdhcpcd -o dhcpcd-curses dhcpcd-curses.o eloop.o -Wl,--as-needed -Wl,-Bstatic -ldhcpcd -Wl,-Bdynamic -lcurses 

/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/../../../../x86_64-pc-linux-gnu/bin/ld: dhcpcd-curses.o: undefined reference to symbol 'curs_set'

/lib64/libtinfo.so.6: error adding symbols: DSO missing from command line

collect2: error: ld returned 1 exit status
```

This because in configure LIB_CURSES variable -ltinfo is missing.

```
diff -Naru dhcpcd-ui-9999.orig/configure dhcpcd-ui-9999/configure

--- dhcpcd-ui-9999.orig/configure       2017-10-27 17:19:40.180468580 +0200

+++ dhcpcd-ui-9999/configure    2017-10-27 17:20:19.070469111 +0200

@@ -469,7 +469,7 @@

 }

 EOF

        if $XCC _curses.c -o _curses -lcurses 2>&3; then

-               LIB_CURSES=-lcurses

+               LIB_CURSES="-lcurses -ltinfo"

        fi

        rm -f _curses.c _curses

 fi
```

EDIT: Not sure if tinfo use flag in ncurses is required but in my system with it enabled I have the error

----------

## fedeliallalinea

 *charles17 wrote:*   

> But dhcpcd-qt is not being built:

 

Strange in my system is installed (use flag are USE="-gtk -libnotify qt5")

```
$ tree /var/tmp/portage/net-misc/dhcpcd-ui-9999/image/

/var/tmp/portage/net-misc/dhcpcd-ui-9999/image/

├── etc

│   └── xdg

│       └── autostart

│           └── dhcpcd-qt.desktop

└── usr

    ├── bin

    │   ├── dhcpcd-curses

    │   ├── dhcpcd-online

    │   └── dhcpcd-qt

    ├── lib

    │   └── systemd

    │       └── system

    │           └── dhcpcd-wait-online.service

    └── share

        └── man

            └── man8

                ├── dhcpcd-curses.8.bz2

                ├── dhcpcd-online.8.bz2

                └── dhcpcd-qt.8.bz2

```

----------

## charles17

 *fedeliallalinea wrote:*   

>  *charles17 wrote:*   But dhcpcd-qt is not being built: 
> 
> Strange in my system is installed (use flag are USE="-gtk -libnotify qt5")

 

Yep, forgot to set qt5.  Thanks for your attention.

Still need to care for the icons:  

```
dhcpcd-qt 

Cannot open file '/usr/share/dhcpcd/icons/hicolor/scalable/status/network-offline.svg', because: No such file or directory

Cannot open file '/usr/share/dhcpcd/icons/hicolor/scalable/status/network-offline.svg', because: No such file or directory

Connecting ...

Status changed to opened

Connected to dhcpcd-6.11.3

Status changed to connected

wlp3s0: Associated with

wlp3s0: Configured 192.168.178.23/24

wwp0s29u1u6i6: Link is up, configuring
```

----------

## fedeliallalinea

Remember to check if tinfo is enable in ncurses (and also add it as dependency) and add -ltinfo to LDFLAGS. I think that this must be checked in configure.

----------

## charles17

 *fedeliallalinea wrote:*   

> You need also add sys-libs/ncurses[tinfo] as dependency (for curses ui).
> 
> I have another erro when compiling package:
> 
> ```
> ...

 

Shouldn't that patch go upstream?  Or is it just only for Gentoo?

----------

## fedeliallalinea

 *charles17 wrote:*   

> Shouldn't that patch go upstream?  Or is it just only for Gentoo?

 

Yes but this patch is only a workaround that only work on a system with ncurses[tinfo] but fails in other case.

The correct way is that configure check if tinfo is present and only in this case add -ltinfo, but I've not idea how to do.

----------

## UberLord

Why should I even know about tinfo? dhcpcd-curses only makes curses calls.

On NetBSD, curses and terminfo are separate libraries and it works fine. Maybe fix ncurses?

----------

## fedeliallalinea

 *UberLord wrote:*   

> Why should I even know about tinfo? dhcpcd-curses only makes curses calls.
> 
> On NetBSD, curses and terminfo are separate libraries and it works fine. Maybe fix ncurses?

 

Probably you right and problem is related to this tracker.

A good patch for gentoo can be

```
diff -Naru dhcpcd-ui-9999.orig/configure dhcpcd-ui-9999/configure

--- dhcpcd-ui-9999.orig/configure       2017-10-27 17:19:40.180468580 +0200

+++ dhcpcd-ui-9999/configure    2017-10-27 17:20:19.070469111 +0200

@@ -469,7 +469,7 @@

 }

 EOF

        if $XCC _curses.c -o _curses -lcurses 2>&3; then

-               LIB_CURSES=-lcurses

+               LIB_CURSES=`pkg-config --libs ncurses`

        fi

        rm -f _curses.c _curses

 fi
```

----------

## charles17

 *fedeliallalinea wrote:*   

> Probably you right and problem is related to this tracker.
> 
> 

 Does it  really only affect the live ebuild or also dhcpcd-ui-0.7.5-r1?

----------

## fedeliallalinea

 *charles17 wrote:*   

>  *fedeliallalinea wrote:*   Probably you right and problem is related to this tracker.
> 
>  Does it  really only affect the live ebuild or also dhcpcd-ui-0.7.5-r1?

 

Only live because version 0.7.5-r1 didn't ncurses ui. You can also resolve problem adding src_prepare function in ebuild

```
# Copyright 1999-2017 Gentoo Foundation

# Distributed under the terms of the GNU General Public License v2

EAPI=6

inherit qmake-utils systemd

DESCRIPTION="Desktop notification and configuration for dhcpcd"

HOMEPAGE="https://roy.marples.name/projects/dhcpcd-ui"

if [[ ${PV} == *9999* ]]; then

        EGIT_REPO_URI="https://github.com/rsmarples/dhcpcd-ui"

        inherit git-r3

        KEYWORDS=""

else

        SRC_URI="https://roy.marples.name/downloads/${PN%-ui}/${P}.tar.bz2"

        KEYWORDS="amd64 x86"

fi

LICENSE="BSD-2"

SLOT="0"

IUSE="debug gtk gtk3 libnotify qt5"

REQUIRED_USE="

        ?? ( gtk gtk3 qt5 )

        libnotify? ( || ( gtk gtk3 ) )"

DEPEND="

        virtual/libintl

        gtk? (

                dev-libs/glib:2

                x11-libs/gdk-pixbuf:2

                x11-libs/gtk+:2

        )

        gtk3? (

                dev-libs/glib:2

                x11-libs/gdk-pixbuf:2

                x11-libs/gtk+:3

        )

        qt5? (

                dev-qt/qtgui:5

                dev-qt/qtcore:5

                dev-qt/qtwidgets:5

        )

        libnotify? ( x11-libs/libnotify )

        sys-libs/ncurses:0"

RDEPEND="${DEPEND}

        >=net-misc/dhcpcd-6.4.4"

src_prepare() {

        default

        # patch for ncurses[tinfo] see #457530

        sed -i 's/LIB_CURSES=-lcurses/LIB_CURSES=`pkg-config --libs ncurses`/' "${S}/configure" || die "sed failed"

}

src_configure() {

        local myeconfargs=(

                $(use_enable debug)

                $(usex gtk  '--with-gtk=gtk+-2.0 --with-icons' '')

                $(usex gtk3 '--with-gtk=gtk+-3.0 --with-icons' '')

                $(usex qt5 '--with-qt --with-icons' '--without-qt')

                $(use_enable libnotify notification)

                $(use gtk || use gtk3 || echo '--without-icons --without-gtk')

                $(use gtk || use gtk3 || use qt5 || echo '--without-icons')

        )

        econf "${myeconfargs[@]}"

}

src_install() {

        emake DESTDIR="${D}" INSTALL_ROOT="${D}" install

        systemd_dounit src/dhcpcd-online/dhcpcd-wait-online.service

}
```

----------

