You are not logged in.

#1 2008-10-12 23:52:38

nuclearsandwich
Member
Registered: 2008-10-12
Posts: 16

Awesome3 + wicked-git + conky-cli

I'm pretty new to tiling wms but now that I've started I can't go back to KDE or even Openbox. I'm wondering what the best way for conky-cli to interact with awesome3 is. I've tried some of the stuff on the wicked page for custom widgets but that generates some kind of default/myconfig hybrid with awesome. I'll post details later but I'm at work and I thought I'd see what the smarter people have to say before I show my attempts in public.
Thanks in advance.

Offline

#2 2008-10-13 01:17:37

pseup
Member
Registered: 2008-06-06
Posts: 103

Re: Awesome3 + wicked-git + conky-cli

It's possible to pipe lua code to 'awesome-client', eg sometextbox.text = "whatever"'. I haven't tried using conky-cli with it, but I assume its possible to just format the TEXT section with the necessary lua.

Offline

#3 2008-10-13 04:37:03

nuclearsandwich
Member
Registered: 2008-10-12
Posts: 16

Re: Awesome3 + wicked-git + conky-cli

I tried putting this in my conky config

TEXT
cpumon.text = '${freq_g}GHz ${cpu}%

with

conky | awesome-client

but nothing happens.
Echoing lua into awesome-client works fine

echo "cpumon.text = 'hello everyone'"| awesome-client

Offline

#4 2008-10-13 06:00:51

nuclearsandwich
Member
Registered: 2008-10-12
Posts: 16

Re: Awesome3 + wicked-git + conky-cli

my original conky config had the second single quote and looked like this

TEXT
cpumon.text = '${freq_g}GHz ${cpu}%'

Offline

#5 2008-10-13 16:23:43

pseup
Member
Registered: 2008-06-06
Posts: 103

Re: Awesome3 + wicked-git + conky-cli

Hmm yes it appears I assumed wrong. I can't get it to work either.

Offline

#6 2008-10-13 19:06:13

ur25
Member
Registered: 2008-10-06
Posts: 13

Re: Awesome3 + wicked-git + conky-cli

From http://awesome.naquadah.org/wiki/index. … r_creation

Here is an example of putting /proc/loadavg to mytextbox:

 mytextbox.text = " " .. execute_command("cat /proc/loadavg") .. " "

I though maybe this might work : mytextbox.text = " " .. execute_command("conky") .. " " ,but it's not. And their example is not working either.

nuclearsandwich wrote:

I tried putting this in my conky config

TEXT
cpumon.text = '${freq_g}GHz ${cpu}%

with

conky | awesome-client

but nothing happens.
Echoing lua into awesome-client works fine

This puts conky on the root window for me.

Last edited by ur25 (2008-10-13 19:10:21)

Offline

#7 2008-10-13 19:44:35

kett
Member
Registered: 2008-04-21
Posts: 104

Re: Awesome3 + wicked-git + conky-cli

I don't use conky, but I was just playing with it a bit.  And it seems that awesome-client won't do anything until conky stops.  You can confirm this yourself by running "conky -i1 | awesome-client", which runs conky once and exits.  That should update awesome.  That said, I don't know what the best solution is.  You probably need some way of outputting conky to a temp file and then having awesome read that file.

Offline

#8 2008-10-13 20:07:30

ur25
Member
Registered: 2008-10-06
Posts: 13

Re: Awesome3 + wicked-git + conky-cli

I've just configured widgets with the wicked library so I don't need conky anymore, but I would like to know the solution anyway.

Offline

#9 2008-10-13 20:45:00

kett
Member
Registered: 2008-04-21
Posts: 104

Re: Awesome3 + wicked-git + conky-cli

This would be a solution:

function updateconkywidget()
  conkywidget.text = io.popen('cat /tmp/conky_output'):lines(){0}
end

function runconky ()
    os.execute('conky -i1 > /tmp/conky_output &')
end

conkywidget = widget({ type = 'textbox', name = 'conkywidget', align = 'right' })

awful.hooks.timer.register(5, updateconkywidget)
awful.hooks.timer.register(5, runconky)

This writes conky's output to a file every 5 seconds in the background.  And then reads it into awesome every 5 seconds as well.  Using this method, the conkyrc file for the example above would simply be:

TEXT
${freq_g}GHz ${cpu}%

Also a benefit to doing this is that you don't use wicked, which isn't as responsive as I'd like it to be.

Last edited by kett (2008-10-13 20:45:59)

Offline

#10 2008-10-13 21:28:15

dante4d
Member
From: Czech Republic
Registered: 2007-04-14
Posts: 176

Re: Awesome3 + wicked-git + conky-cli

kett wrote:

I don't use conky, but I was just playing with it a bit.  And it seems that awesome-client won't do anything until conky stops.  You can confirm this yourself by running "conky -i1 | awesome-client", which runs conky once and exits.  That should update awesome.  That said, I don't know what the best solution is.  You probably need some way of outputting conky to a temp file and then having awesome read that file.

Have you guys tried outputting empty line into awesome-client? awesome-client manpage:

When you pipe multiple lines into awesome-client, an empty line will flush already collected lines into awesome with an according immediate execution.

Maybe because conky runs "forever" piping into awesome-clinet, you won't get any action until conky stops or outputs empty line...

Offline

#11 2008-10-13 21:48:57

nuclearsandwich
Member
Registered: 2008-10-12
Posts: 16

Re: Awesome3 + wicked-git + conky-cli

So what would be the best way to get conky to output an empty line? None of the conky variables appear to do that, nor does a newline character. Adding extra lines to the end of TEXT doesn't appear to do anything either.

Offline

#12 2008-10-13 22:03:34

Gigamo
Member
Registered: 2008-01-19
Posts: 394

Re: Awesome3 + wicked-git + conky-cli

There's a simple mod to the conky sourcecode to do just that, found here on the awesome wiki.

Offline

#13 2008-10-13 23:15:18

nuclearsandwich
Member
Registered: 2008-10-12
Posts: 16

Re: Awesome3 + wicked-git + conky-cli

Awesome! (no pun intended) That patch did the trick. The source has changed slightly since the wiki entry. The change is still in conky.c but at

 width_of_s = get_string_width(s);
        if ((output_methods & TO_STDOUT) && draw_mode == FG) {
                printf("%s\n\n", s);
                fflush(stdout); /* output immediately, don't buffer */
        }

which starts at what is currently line 6673. Thanks for everyone's help. Is this little patch worth another package in the aur or is it too specific. I'm really new to the Arch community and don't know how to contribute back in a meaningful way yet.

Last edited by nuclearsandwich (2008-10-13 23:19:40)

Offline

#14 2008-10-14 19:24:41

dante4d
Member
From: Czech Republic
Registered: 2007-04-14
Posts: 176

Re: Awesome3 + wicked-git + conky-cli

I wonder how often is the solution old simple... read the manual smile

Offline

#15 2008-10-19 14:45:40

ur25
Member
Registered: 2008-10-06
Posts: 13

Re: Awesome3 + wicked-git + conky-cli

Hi, I've followed the instructions and modified the conky.c file before compiling conky but it doesn't seem to be working.

Here is my .conkyrc

background no
no_buffers yes
out_to_console yes
update_interval 1 
uppercase no
use_spacer none
total_run_times 0

TEXT
conky_textbox.text = 'test'

This does nothing :

$conky | awesome-client 
^CConky: received SIGINT or SIGTERM to terminate. bye!

Here is what conky outputs :

$conky 
conky_textbox.text = 'test'
conky_textbox.text = 'test'
conky_textbox.text = 'test'
conky_textbox.text = 'test'
conky_textbox.text = 'test'
conky_textbox.text = 'test'
conky_textbox.text = 'test'
conky_textbox.text = 'test'
conky_textbox.text = 'test'
conky_textbox.text = 'test'
conky_textbox.text = 'test'
conky_textbox.text = 'test'
^Cconky_textbox.text = 'test'
Conky: received SIGINT or SIGTERM to terminate. bye!

And this line IS working :

$echo "conky_textbox.text = 'test'" | awesome-client

I don't understand what the problem is, can somebody help me?

Thank you!

Last edited by ur25 (2008-10-19 14:46:18)

Offline

#16 2008-10-20 23:22:05

nuclearsandwich
Member
Registered: 2008-10-12
Posts: 16

Re: Awesome3 + wicked-git + conky-cli

I used the conky-cli package from the AUR as a starting point, modified the source .tar and the md5sum in the PKGBUILD and then built the conky-cli-awesome package and installed it with pacman -U
This is my conky config

update_interval 2.0
TEXT
conkybar.text = 'Clock: ${freq_g}GHz    CPU: ${cpu}%            Processes/Running: ${processes}/${running_processes}            Memory: ${memperc}%                                                                                     Battery: ${battery}'

When I login it I've configured it to run awesome.sh which starts some terminals and starts piping conky into awesome client with this line

conky | awesome-client &

Offline

#17 2008-10-22 00:05:53

ur25
Member
Registered: 2008-10-06
Posts: 13

Re: Awesome3 + wicked-git + conky-cli

Hi,

I think the modification I do in the src/conky.c are not taken into consideration because when I enter this in the console it is working : conky -i1 | awesome-client.

I even tried to add one more "\n" (three in total) and it's doing nothing. Maybe I'm doing something wrong, here is what I do in order :

1- I download conky-cli from aur.archlinux.org
2- I untar it (tar xvf conky-cli...).
3- I edit the file src/conky.c and change the line number 6675 so it looks like this :    printf("%s\n\n", s);
4- I download the PKGBUILD and put it in the root folder of the conky-cli folder.
5- I edit the PKGBUILD and comment the md5sum line.
6- I enter this command makepkg -c.
7- I enter this command sudo pacman -U conky-cli.....

As you can see from the output of conky, the extra "\n" seems to do nothing :

$conky 
conky_textbox.text = 'Clock: 1.99GHz    CPU: 5%            Processes/Running: 77/1            Memory: 12%'
conky_textbox.text = 'Clock: 1.99GHz    CPU: 10%            Processes/Running: 76/2            Memory: 12%'
^Cconky_textbox.text = 'Clock: 1.99GHz    CPU: 10%            Processes/Running: 76/1            Memory: 12%'

Thank you for your help!

Offline

#18 2008-10-22 02:32:41

nuclearsandwich
Member
Registered: 2008-10-12
Posts: 16

Re: Awesome3 + wicked-git + conky-cli

Did you tar and gzip the source so the makepkg uses it instead of downloading a new package?

Offline

#19 2008-10-22 23:23:15

ur25
Member
Registered: 2008-10-06
Posts: 13

Re: Awesome3 + wicked-git + conky-cli

nuclearsandwich wrote:

Did you tar and gzip the source so the makepkg uses it instead of downloading a new package?

Thank you! smile

It was a stupid mistake but it is not explained in the beginner's guide. I thought that I had to download the source from AUR and put the PKGBUILD inside, but the PKGBUILD actually downloads them!

Offline

#20 2008-10-22 23:24:57

nuclearsandwich
Member
Registered: 2008-10-12
Posts: 16

Re: Awesome3 + wicked-git + conky-cli

Glad that worked.

Offline

Board footer

Powered by FluxBB