Float your conky

Just about every conky setup I see has it pegged to the desktop, immovable and locked into place. Which is fine, except there are times (or at least there are for me) when it might be nice to shift conky slightly, so I can see what’s happening without shifting other windows around.

To that end, I cooked up a .conkyrc file that displays a 200-pixel wide panel with the traditional system indicators in place, plus the settings that float it on the first workspace of my Openbox setup. Because you expect it, here’s a screenshot for you.

With this setup, I can use the ALT key and the left mouse button (the standard window drag combo) to move conky around the desktop, to whereever it suits me. Conky always stays in the background so it never blocks a window, and I keep the nifty transparent mode I like so much.

Here’s the code, to get you started.

double_buffer yes
update_interval 3.0
background yes

own_window yes
own_window_transparent yes
own_window_hints undecorated,below,skip_taskbar

use_xft yes
override_utf8_locale no
xftfont Bitstream Vera Sans Mono:size=7
xftalpha 0.8
draw_shades no
draw_outline yes
draw_borders yes
uppercase yes
use_spacer no

border_margin 9
border_width 1

default_color white
default_shade_color black
default_outline_color black

alignment top_right
minimum_size 200
gap_x 9
gap_y 9

TEXT
${alignc}${time %I:%M %p}, ${time %a}., ${time %b. %e}, ${time %G}
${alignc}Ubuntu Linux $kernel
${alignc}hostname $nodename at ${addr ra0}
${alignc}${execi 1000 cat /proc/cpuinfo | grep 'model name' | sed -e 's/model name.*: //'}
${alignc}$uptime uptime


CPU Load: ${alignr}$cpu%
${cpugraph 20,200 000000 ffffff}
Load averages: ${alignr}$loadavg

Processes: ${alignr}$running_processes of $processes running
Highest CPU usage:
${color yellow} ${top name 1}${alignr}${top cpu 1}
${color}${top name 2}${alignr}${top cpu 2}
${top name 3}${alignr}${top cpu 3}
${top name 4}${alignr}${top cpu 4}
Highest memory usage:
${color yellow} ${top_mem name 1}${alignr}${top_mem mem 1}
${color}${top_mem name 2}${alignr}${top_mem mem 2}
${top_mem name 3}${alignr}${top_mem mem 3}
${top_mem name 4}${alignr}${top_mem mem 4}

Resources:
Memory usage: ${alignr}${memperc}% (${mem}b/${memmax}b)
${membar 3,200}
Swap usage: ${alignr}${swapperc}% (${swap}b/${swapmax}b)
${swapbar 3,200}
HDD free: ${alignr}${fs_free_perc /}% (${fs_free /}b/${fs_size /}b)
${fs_bar 3,200 /}

NET:
Up:${alignr}${upspeed ra0}Kbps, ${totalup ra0}b total
${upspeedgraph ra0 20,200 000000 ffffff}
Down: ${alignr}${downspeed ra0}Kbps, ${totaldown ra0}b total
${downspeedgraph ra0 20,200 000000 ffffff}

The magic happens at these lines:

own_window yes
own_window_transparent yes
own_window_hints undecorated,below,skip_taskbar

That tells conky to run in its own window (which I want, since I want it to be movable), to keep the transparent effect (which I prefer), to set the window to be undecorated (in other words, no handles, borders or menubar), keep it below the other windows and not to put it in a taskbar. I don’t use a panel, as you can see, but I know some other folks do, so I thought I would keep that in there.

There are some downsides, which I leave to you to conquer, since they don’t bother me. First there’s a slight delay updating the background image when you move conky — about the same as the update interval you set in the .conkyrc file. I suppose if you knock down the interval rate, you’ll get a better refresh response.

Second, without window decorations, you can’t directly move conky from one workspace to another. Personally I think I can conquer this with Openbox keybind settings, but since it doesn’t bother me enough, I’ll probably leave it at that.

Have fun. Check out the conky show-off thread here for more ideas.

P.S.: If you cut and paste that text into your .conkyrc file, remember that I use ra0 as my net interface. You might get a lot of zeroes in weird places if you forget to switch it to eth0 or whatever you use. 😉

8 thoughts on “Float your conky

  1. Logic

    This may sounds a bit weird but I am unable to locate the ~/.conkyrc file.

    Created the file and copied your stuff above into the file and started conky. Still conky does not recognise it.

    Any idea what is wrong?

    By the way, I am using Kubuntu Edgy.

    Reply
  2. kmandla Post author

    That is strange, Logic. I’m not real familiar with Kubuntu, but it shouldn’t be so different that it can’t find the .conkyrc file.

    I’m shooting in the dark here, but try uninstalling it with sudo aptitude remove –purge conky, then make sure it deleted the .conkyrc file you made. Then create a .conkyrc file before reinstalling it with “sudo aptitude install conky”. If we’re lucky, Ubuntu will sense that file while it’s installing conky (it might even ask if you want to keep it, but I doubt it), and use it when it runs.

    By the way, you’re not running conky as root, are you? Conky starts with just “conky &” from the terminal, not “sudo conky”. From the .xinitrc file, it needs only a “conky &” entry.

    If you’re still having problems, post a thread on the Ubuntu forums and PM me there. It’s possible another Kubuntu user has run into this problem and can help us out. Cheers!

    Reply
  3. KE610

    I’m using Kubuntu Edgy and what I did was just install conky
    sudo apt-get install conky

    Then created a file in my home directory called .conkyrc
    Copied and pasted the code into it and saved it

    alt + F2 (to run files) and type conky

    Nice stuff Thanx

    Reply
  4. Andy Bleaden

    Hi

    Been playing around with the conky script as I am on a wireless connection here but did a few extras which you may like. Feel free to change any you find interesting or not appropriate to your needs.

    Here is the script:

    # set to yes if you want Conky to be forked in the background
    background no

    cpu_avg_samples 1
    net_avg_samples 1

    out_to_console no

    # Use double buffering (reduces flicker, may not work for everyone)
    double_buffer yes

    # Create own window instead of using desktop (required in nautilus)
    own_window yes
    own_window_type normal
    own_window_transparent yes
    own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

    #own_window yes
    #own_window_transparent no

    # Use Xft?
    use_xft yes

    # Xft font when Xft is enabled
    xftfont Free Sans:size=8

    uppercase no

    # Text alpha when using Xft
    xftalpha 0.8

    # Update interval in seconds
    update_interval 1

    # Draw shades?
    draw_shades yes

    # Draw outlines?
    draw_outline yes

    # Draw borders around text
    draw_borders no

    # Stippled borders?
    stippled_borders 3

    # border margins
    border_margin 4

    # border width
    border_width 1

    # Text alignment, other possible values are commented
    #minimum_size 8 8
    gap_x 725
    gap_y 11
    #alignment top_left
    alignment top_right
    #alignment bottom_left
    #alignment bottom_right

    # Add spaces to keep things from moving about? This only affects certain objects.
    use_spacer yes

    # Subtract file system buffers from used memory?
    no_buffers yes

    TEXT
    ${alignc}${color yellow} Andy Bleaden Desktop Kubuntu 2008
    ${alignc}${color yellow}$sysname kernel $kernel
    ${alignc}${color yellow}${exec cat /etc/issue.net} on $machine host $nodename
    ${alignc}${color yellow}${time %I:%M %p}, ${time %a}., ${time %b. %e}, ${time %G}
    ${color yellow}${execi 1000 cat /proc/cpuinfo | grep ‘model name’ | sed -e ‘s/model name.*: //’} ${color yellow} ${freq_dyn}Mhz
    ${color yellow}Current CPU usage & temp:${color yellow} ${cpu}%${color yellow}, ${color yellow}${acpitemp}C ${color yellow}/${color yellow} ${acpitempf}F
    ${color yellow}Load average: ${color yellow} $loadavg

    ${color yellow}CPU usage ${alignr}PID CPU% MEM%
    ${color yellow} ${top name 1}${alignr}${top pid 1} ${top cpu 1} ${top mem 1}
    ${color yellow} ${top name 2}${alignr}${top pid 2} ${top cpu 2} ${top mem 2}
    ${color yellow} ${top name 3}${alignr}${top pid 3} ${top cpu 3} ${top mem 3}
    ${color yellow} ${top name 4}${alignr}${top pid 4} ${top cpu 4} ${top mem 4}
    ${color yellow} ${top name 5}${alignr}${top pid 5} ${top cpu 5} ${top mem 5}

    ${color yellow}Mem usage
    RAM: $memperc% ${membar 6}$color
    ${color yellow} ${top_mem name 1}${alignr}${top_mem pid 1} ${top_mem cpu 1} ${top_mem mem 1}
    ${color yellow} ${top_mem name 2}${alignr}${top_mem pid 2} ${top_mem cpu 2} ${top_mem mem 2}
    ${color yellow} ${top_mem name 3}${alignr}${top_mem pid 3} ${top_mem cpu 3} ${top_mem mem 3}
    ${color yellow} ${top_mem name 4}${alignr}${top_mem pid 4} ${top_mem cpu 4} ${top_mem mem 4}

    ${color yellow}RAM Usage:${color yellow} $mem/$memmax – $memperc% $membar
    ${color yellow}Swap Usage:${color yellow} $swap/$swapmax – $swapperc% ${swapbar}
    Swap: $swapperc% ${swapbar 6}$color
    ${color yellow}Processes:${color yellow} $processes ${color yellow}Running:${color yellow} $running_processes ${color yellow}
    ${color yellow}Uptime ${color yellow}’$uptime’

    ${color yellow}Hard drives:

    ${color yellow}My system ${color yellow}${fs_used /}/${fs_size /} ${fs_bar /}
    ${color yellow}Home ${color yellow}${fs_used /home}/${fs_size /home} ${fs_bar /home}
    ${color yellow}Elements ${color yellow}${fs_used /media/sda1}/${fs_size /media/sda1} ${fs_bar /media/sda2}
    ${color yellow}My Book ${color yellow}${fs_used /media/sda2}/${fs_size /media/sda2} ${fs_bar /media/sda1}

    ${color yellow}Wireless Connection:

    ${color yellow}${exec iwconfig wlan0 | grep “ESSID” | cut -c 11-}
    ${color yellow}${exec iwconfig wlan0 | grep “Frequency” | cut -c 25-}
    ${color yellow}Network Gateway Address (${addr wlan0})
    ${color yellow}Download: ${color yellow}${totaldown wlan0}
    ${color yellow}Upload: ${color yellow}${totalup wlan0}
    ${color yellow}Download speed: ${color yellow}${downspeed wlan0} k/s${color yellow} ${color yellow} upload speed: ${color yellow}${upspeed wlan0} k/s
    ${color yellow}${downspeedgraph wlan0 15,150 ff0000 0000ff} $alignr${color yellow}${upspeedgraph wlan0) 15,150 0000ff ff0000}

    ${color yellow}Inbound: ${color yellow}${tcp_portmon 1 32767 count} ${color yellow}Outbound: ${color yellow}${tcp_portmon 32768 61000 count} ${color yellow}Total: ${color yellow}${tcp_portmon 1 65535 count}
    ${color yellow}Outbound Connection ${alignr} Remote Service/Port${color yellow}
    ${tcp_portmon 32768 61000 rhost 0} ${alignr} ${tcp_portmon 32768 61000 rservice 0}
    ${tcp_portmon 32768 61000 rhost 1} ${alignr} ${tcp_portmon 32768 61000 rservice 1}
    ${tcp_portmon 32768 61000 rhost 2} ${alignr} ${tcp_portmon 32768 61000 rservice 2}
    ${tcp_portmon 32768 61000 rhost 3} ${alignr} ${tcp_portmon 32768 61000 rservice 3}
    ${tcp_portmon 32768 61000 rhost 4} ${alignr} ${tcp_portmon 32768 61000 rservice 4}
    ${tcp_portmon 32768 61000 rhost 5} ${alignr} ${tcp_portmon 32768 61000 rservice 5}

    Reply
  5. Pingback: Going over covered ground « Motho ke motho ka botho

Leave a reply to wh0rd Cancel reply