Making a Status Bar V
Contents |
Use the Source, Luke
Ok, here's how to get conky working with awesome.
This is what I did on my system (debian lenny/sid) and it works!
Get the Source
- Get the source archive from Conky's SourceForge site
Modify the Source
- Edit conky.c using your editor of choice
- Find this block (line numbers are for reference only):
5800: if (out_to_console) {
5801: printf("%s\n", s);
5802: fflush(stdout); /* output immediately, don't buffer */
5803: }
- Modify this line:
5801: printf("%s\n", s);
to read:
5801: printf("%s\n\n", s); //Note the extra newline!
- Save it
Alternate Patch
- Add the following block to the end of conky.c:draw_text()
if (out_to_console) {
printf("\n");
fflush(stdout);
}
Compile the Source
- Configure your newly modified conky:
$ ./configure --disable-x11
- Compile it:
$ make
- Install it:
$ sudo make install
Use Your Newly Compiled Conky
- Edit ~/.awesomerc, and add the following:
statusbar "bottom" {
position = "bottom"
height = 18
width = 0
textbox cpulabel {
}
graph cpugraph {
data {
max = 100.0
style = "bottom"
fg = "#006e96"
}
bg = "#000000"
width = 100
align = "left"
}
}
- Create/Edit ~/.conkyrc:
background no
no_buffers yes
out_to_console yes
update_interval 1
uppercase no
use_spacer no
total_run_times 0
TEXT
0 widget_tell cpulabel cpu:
0 widget_tell cpugraph ${cpu cpu0}
- Edit ~/.xinitrc:
conky | awesome-client & exec awesome
- Restart and enjoy!
--Cciulla 02:54, 4 March 2008 (CET)
Debian package
Download a debian package of the patched (working) conky 1.5.1 here, tested with current 32bit i386 etch, lenny and sid, just download and do the usual
wget http://liksom.info/conky_1.5.1-1_i386.deb sudo dpkg -i conky_1.5.1-1_i386.deb
--Snauth 09:46, 2 May 2008 (UTC)
Now Lenny has conky 1.6.0 and sid version 1.6.1-1. To patch the current version of Debian install devscripts and fakeroot, add the appropriate deb-src to /etc/apt/sources.list and follow this steps (tested with Sid):
apt-get source conky
sudo aptitude build-dep conky
cd conky-1.6.1
patch -p1
--- a/debian/rules 2008-10-19 17:13:03.000000000 +0200
+++ b/debian/rules 2008-10-19 17:09:52.701443644 +0200
@@ -52,7 +52,7 @@
--host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
--prefix=/usr --sysconfdir=/etc \
--mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info \
- --enable-debug --enable-rss $(EXTRA_CONF_ARGS)
+ --enable-debug --enable-rss --disable-x11 $(EXTRA_CONF_ARGS)
touch debian/configure-stamp
^D
cat >debian/patches/conky_in_awesome
--- a/src/conky.c 2008-08-14 19:10:43.000000000 +0200
+++ b/src/conky.c 2008-10-19 17:10:03.702070526 +0200
@@ -6672,7 +6672,7 @@
width_of_s = get_string_width(s);
if ((output_methods & TO_STDOUT) && draw_mode == FG) {
- printf("%s\n", s);
+ printf("%s\n\n", s);
fflush(stdout); /* output immediately, don't buffer */
}
memset(tmpstring1, 0, text_buffer_size);
^D
echo conky_in_awesome >> debian/patches/series
dch -l awesome "Patched to work with awesome"
dpkg-buildpackage
sudo debi
^D means "Hit control+D". Currently, I don't have a place to upload the final conky_1.6.1-1awesome1_i386.deb, so you have to manually apply this steps. If somebody can upload it somewhere, we could change this manual thing to something similar to what Snauth described.
--Vicho 15:34, 19 October 2008 (UTC)
Using an init script
I want to run "conky | awesome-client" with more control over the process(es) (for some reason they zombify when my pc hibernates) therefore I start/stop it with this init script:
#! /bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/bin/conky.sh
NAME=conky
DESC=conky
USER=your_user_name
#test -x $DAEMON || exit 0
set -e
case "$1" in
start)
echo -n "Starting $DESC: "
start-stop-daemon --background --start --chuid $USER --exec $DAEMON
;;
stop)
echo -n "Stopping $DESC: "
kill `ps uxc -A | grep -i $NAME | awk '{print $2}'`
;;
esac
exit 0
This calls this little shell script conky.sh (necessary to force start-stop-daemon to redirect to awesome-client):
#!/bin/sh exec /usr/local/bin/conky | /usr/bin/awesome-client
--Snauth 09:46, 2 May 2008 (UTC)