blogable.eu

computer – mobile phone – life

Browsing Posts tagged Conky

And again, it’s Conky-time. After writing a small how-to and integrating Amrok 2 into this nice little piece of software, I decided to write yet another Conky post. This time about starting the programme automatically with each start of Ubuntu. This is done by creating a script, containing the following:

#!/bin/sh
sleep 25
conky

Name the script .conky_autostart and save it. To make it executable type chmod a+x .conky_autostart. That’s basically it. Now you can add this file to your Autostart and enjoy Conky every time you boot. The time value (25) can be reduced. I achieved best results with such a high number but others might be happy with 10 or even less. The value describes the delay with which Conky will start. If you use Beryl and encounter starting problems, increase the value until it works. Flickering during the use of Conky is a known issue and can be solved by editing your settings in the .conkrc file: double buffer = yes and own window = yes.

Continuing my Conky post series, I will introduce you to the integration of Amarok 2 into Conky. I prefer this option over the OSD (On Screen-Display for song information) any day. The reason is that the OSD will only appear at the beginning of a song and while it does that, it tends to be in the way. I’m aware that you can change the position, but I’m still not happy with that. Wherever it is, it will overlay your internet browser, image editor or similar. Not being able to check what song is curently playing (if you missed the start) and sometimes simply not wanting to see every song are other reasons for me to implement Amarok 2 into Conky. I repeatedly said Amarok 2, because the integration of Amarok 1 is a different story.

Read my Conky article if you still don’t know where to start with Conky. Otherwise copy and paste this into your .conkyrc file:

${color #000000}Music ${hr 1}
${color #BBB3B3} ${execi 10 ~/.conky/amarok artist}
${color #BBB3B3} ${execi 10 ~/.conky/amarok title}
${color #BBB3B3} ${execi 10 ~/.conky/amarok album}
${color #BBB3B3} ${execi 10 ~/.conky/amarok year}
${color #BBB3B3} ${execi 10 ~/.conky/amarok genre}

For further questions on this, visit this forum, where additional questions and ideas on my code are available. Afterall, this is just a basis you can build upon. :) After you integrated the above text, you will need to install qdbus which is available in the software packages.

Until now, this by itself will not work. As you can see in the above text, I referred to ./conky. This is the folder you will need to create a new document in, I called amarok. As far as I know you can change both folder- and filename, but it must be changed in the above text accordingly. Now you can copy and paste the following content into the just created file (yes we’re almost done ;) ):

#!/bin/bash
# based on: amaroK info display script by eirc <eirc.eirc@gmail.com>
# amarok2 info display script by fireandfuel <fireandfuel@hotmail.de>
#
# requirements: amaroK 2 (!)

case “$1″ in

# Now Playing Info
artist) qdbus org.kde.amarok /Player GetMetadata | grep artist ;;
title) qdbus org.kde.amarok /Player GetMetadata | grep title ;;
album) qdbus org.kde.amarok /Player GetMetadata | grep album ;;
year) qdbus org.kde.amarok /Player GetMetadata | grep year ;;
genre) qdbus org.kde.amarok /Player GetMetadata | grep genre ;;

esac

Once this file is saved, type the following command into your console: chmod u+x name_of_the_script. If the document (script) is placed elsewhere then your desktop, you will have to add the details about that into the command or change into the folder where the file is save and enter the command there. Restart Conky and enjoy Amarok 2 details on your desktop.

Conky is a really nice little programme when it comes to monitoring and displaying various system information on your desktop.

I’m a friend of tidy desktops, but need detailed information about my system, especially while using virtualisation software. This information should include my CPU and RAM usage as well as networking details. Conky does a great job with this, when set up correctly. While it isn’t a programme that shows off with it’s graphical user interface, simply because it has none, it’s easy on your resources.  Not having a GUI might sound annoying and like a lot of work at first, but it turns out to be not that big a problem at all.

Getting started:

To install Conky in Ubuntu type sudo apt-get install conky into your console or download the package and  compile it from source. Now create a texfile with an editor of your choice and name it .conkyrc. After pasting the following content, you can save it where you like. Keep in mind that you want to be able to find it quickly though, which is why I’m using the Home folder.

To give you an impression of what Conky is capable of, copy and paste this into the just created document:

# set to yes if you want Conky to be forked in the background
background yes
use_xft yes
xftfont HandelGotD:size=9
xftalpha 0.5
update_interval 4.0
total_run_times 0
own_window no
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 200 5
maximum_width 250
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default colour grey
default_shade_color grey
default_outline_color grey
alignment bottom_right
gap_x 12
gap_y 48
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes

TEXT

${color #000000}Time & Date ${hr 1}
${color #BBB3B3}${time %k:%M:%S}
${color #BBB3B3}${Time %A, %m.%d.%Y}

${color #000000}System ${hr 1}
${color #BBB3B3}Uptime $alignr $uptime
${color #BBB3B3}Power $alignr $acpiacadapter
${color #BBB3B3}Battery $alignr $battery
${color #BBB3B3}Temperature $alignr $acpitemp°C
${color #BBB3B3}CPU $alignr ${cpu cpu0}%
${color #BBB3B3}$cpubar $alignr
${color #BBB3B3}Ram $alignc $mem / $memmax $alignr $memperc%
${color #BBB3B3}$membar $alignr

${color #000000}Processes ${hr 1}
${color #BBB3B3}$processes processes ($running_processes running)
${top name 1} $alignr ${top cpu 1} ${top mem 1}
${top name 2} $alignr ${top cpu 2} ${top mem 2}
${top name 3} $alignr ${top cpu 3} ${top mem 3}
${top name 4} $alignr ${top cpu 4} ${top mem 4}
${top name 5} $alignr ${top cpu 5} ${top mem 5}

${color #000000}Network ${hr 1}
${color #BBB3B3}Traffic ${time %B}:                ${color #BBB3B3}Down:  ${execi 300 vnstat -m | grep “`LC_ALL=C date +”%b ‘%y”`” | awk ‘{print $3 $4}’} $alignr
${color #BBB3B3}Up:  ${execi 300 vnstat -m | grep “`LC_ALL=C date +”%b ‘%y”`” | awk ‘{print $6 $7}’} $alignr
${color #BBB3B3}Inbound $alignr ${downspeed eth0} kb/s
${color #BBB3B3}${downspeedgraph eth0} $alignr
${color #BBB3B3}Outbound $alignr ${upspeed eth0} kb/s
${color #BBB3B3}${upspeedgraph eth0}

In addition to that, you would have to install vnstat if you would like to see information about your traffic and internet speed.

To start, type conky in your console. When you make changes to the .conkyrc file and you would like to see whether it works and/or looks the way you want, type killall -SIGUSR1 conky. This will restart Conky directly with your changes.

To find out more about Conky, check the documentary on settings or read forums such as Ubuntu Forums. Especially this is a good start in my opinion, as you can understand the different commands by looking at the screenshots and comparing the provided code.

# set to yes if you want Conky to be forked in the background
background yes
use_xft yes
xftfont HandelGotD:size=9
xftalpha 0.5
update_interval 4.0
total_run_times 0
own_window no
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 200 5
maximum_width 250
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default colour grey
default_shade_color grey
default_outline_color grey
alignment bottom_right
gap_x 12
gap_y 48
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes

TEXT

${color #000000}Time & Date ${hr 1}
${color #BBB3B3}${time %k:%M:%S}
${color #BBB3B3}${Time %A, %m.%d.%Y}

${color #000000}System ${hr 1}
${color #BBB3B3}Uptime $alignr $uptime
${color #BBB3B3}Power $alignr $acpiacadapter
${color #BBB3B3}Battery $alignr $battery
${color #BBB3B3}Temperature $alignr $acpitemp°C
${color #BBB3B3}CPU $alignr ${cpu cpu0}%
${color #BBB3B3}$cpubar $alignr
${color #BBB3B3}Ram $alignc $mem / $memmax $alignr $memperc%
${color #BBB3B3}$membar $alignr

${color #000000}Processes ${hr 1}
${color #BBB3B3}$processes processes ($running_processes running)
${top name 1} $alignr ${top cpu 1} ${top mem 1}
${top name 2} $alignr ${top cpu 2} ${top mem 2}
${top name 3} $alignr ${top cpu 3} ${top mem 3}
${top name 4} $alignr ${top cpu 4} ${top mem 4}
${top name 5} $alignr ${top cpu 5} ${top mem 5}

${color #000000}Network ${hr 1}
${color #BBB3B3}Traffic ${time %B}:                ${color #BBB3B3}Down:  ${execi 300 vnstat -m | grep “`LC_ALL=C date +”%b ‘%y”`” | awk ‘{print $3 $4}’} $alignr
${color #BBB3B3}Up:  ${execi 300 vnstat -m | grep “`LC_ALL=C date +”%b ‘%y”`” | awk ‘{print $6 $7}’} $alignr
${color #BBB3B3}Inbound $alignr ${downspeed eth0} kb/s
${color #BBB3B3}${downspeedgraph eth0} $alignr
${color #BBB3B3}Outbound $alignr ${upspeed eth0} kb/s
${color #BBB3B3}${upspeedgraph eth0}

${color #000000}Music ${hr 1}
${color #BBB3B3} ${execi 10 ~/.conky/amarok artist}
${color #BBB3B3} ${execi 10 ~/.conky/amarok title}
${color #BBB3B3} ${execi 10 ~/.conky/amarok album}
${color #BBB3B3} ${execi 10 ~/.conky/amarok year}
${color #BBB3B3} ${execi 10 ~/.conky/amarok genre}