-   Linux - General (
-   -   Ifplugd > Awesome WM 3.4.5-1 widget using awesome-client (

Biowaste 07-03-2010 11:16 AM

Ifplugd > Awesome WM 3.4.5-1 widget using awesome-client
Hi LQ,

I'm trying to make a widget for my wibox that is a text field that updates when the network cable is plugged in or unplugged. For the detection purpose, that can also be customized to do things, someone suggested using ifplugd. So I have a text widget in awesome that is to be remotely updated by ifplugd via awesome-client.

I've made the widget:

-- }}File: rc.lua:
 Detect ifplugstatus 
ips = widget({ type = "textbox" })
ips.text = ""

I've made sure awful.remote is loaded:

File: rc.lua:

I've configured ifplugd:

File: ifplugd.action:
        run-parts --arg="$1" --arg="$2" /etc/ifplugd/action.d/
        echo "ips.text =\"up\"" | awesome-client
        run-parts --reverse --arg="$1" --arg="$2" /etc/ifplugd/action.d/
        echo "ips.text =\"dn\"" | awesome-client

and I've written the scripts:



sh -c 'echo "ips.text = \"up\"" | awesome-client'
#exec urxvt



sh -c 'echo "ips.text = \"dn\"" | awesome-client'
# exec x-terminal-emulator

* The widget works: I have a textbox that I can write things into.
* The remote activation works: I can write the "sh -c 'echo..." command in a terminal, and it will change the text succesfully. I can also sh the scripts and that works as well.
* Ifplugd does execute the scripts, because when I uncomment the exec lines, it alternates between starting urxvt and x-terminal emulator when I plug in or unplug the network cable. (done to give me a visible output to see whether it executes at all)

For some reason, however, it either doesn't or fails to execute the sh -c 'echo [..]' command, and doesn't affect the text. To try another solution I also configured it to execute a script instead of the line itself, but that doesn't work either.

I really don't know why? I've been thinking that maybe it requires permissions as my user or something, or maybe it doesn't output the command to the same place where the widget is looking for input?
I can't seem to figure it out, so any thoughts, ideas, suggestions or solutions would be great!

Biowaste 07-03-2010 11:41 AM

Accidentally found something out:
The terminals it starts are logged in as "root", not "ifplugd", my user name or something else.
When I try to execute the command myself as root, I get this error message:

"Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.naquadah.awesome.awful was not provided by any .service files"
That could look like the problem? Any ideas what can be done about that?

antegallya 07-04-2010 06:04 AM


awesome-client communicate with awesome through dbus, so it has to be able to connect to your awesome user's dbus session. IMHO the easiest way is to run awesome-client as your awesome user like

su lys -c 'echo "ips.text = \"dn\"" | awesome-client'

Biowaste 07-09-2010 07:37 AM

Right, thanks!

All times are GMT -5. The time now is 12:23 AM.