LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 07-03-2010, 12:16 PM   #1
Biowaste
LQ Newbie
 
Registered: Jul 2010
Location: Denmark
Distribution: Archlinux
Posts: 9

Rep: Reputation: 0
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:
Code:
-- }}File: rc.lua:
 Detect ifplugstatus  
ips = widget({ type = "textbox" })
ips.text = ""
I've made sure awful.remote is loaded:
Code:
File: rc.lua:
require("awful.remote")
I've configured ifplugd:
Code:
File: ifplugd.action:
up)
	run-parts --arg="$1" --arg="$2" /etc/ifplugd/action.d/
	echo "ips.text =\"up\"" | awesome-client
	/home/lys/sh/up.sh
	;;
down)
	run-parts --reverse --arg="$1" --arg="$2" /etc/ifplugd/action.d/
	echo "ips.text =\"dn\"" | awesome-client
	/home/lys/sh/dn.sh
	;;
and I've written the scripts:

Code:
File: up.sh:
#!/bin/sh

sh -c 'echo "ips.text = \"up\"" | awesome-client'
#exec urxvt
Code:
File: dn.sh:
#!/bin/sh

sh -c 'echo "ips.text = \"dn\"" | awesome-client'
# exec x-terminal-emulator
Status:
* 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)

Problem:
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!
 
Old 07-03-2010, 12:41 PM   #2
Biowaste
LQ Newbie
 
Registered: Jul 2010
Location: Denmark
Distribution: Archlinux
Posts: 9

Original Poster
Rep: Reputation: 0
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:
Code:
"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?
 
Old 07-04-2010, 07:04 AM   #3
antegallya
Member
 
Registered: Jun 2008
Location: Belgium
Distribution: Debian
Posts: 109

Rep: Reputation: 42
Hello,

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
Code:
su lys -c 'echo "ips.text = \"dn\"" | awesome-client'
 
1 members found this post helpful.
Old 07-09-2010, 08:37 AM   #4
Biowaste
LQ Newbie
 
Registered: Jul 2010
Location: Denmark
Distribution: Archlinux
Posts: 9

Original Poster
Rep: Reputation: 0
Right, thanks!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Awesome WM 3.4.5-1: Edit Prompt widget help (Lua) Biowaste Linux - Desktop 3 08-20-2013 05:02 PM
Why is LQ so awesome? lupusarcanus LQ Suggestions & Feedback 13 12-25-2009 08:11 AM
Awesome pk69 LinuxQuestions.org Member Intro 2 10-22-2005 03:44 PM
This Is So Awesome!!!! aznboi12321 DamnSmallLinux 4 04-02-2005 09:24 PM


All times are GMT -5. The time now is 06:58 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration