You are not logged in.

#1 2009-12-08 18:04:22

LeoSolaris
Member
From: South Carolina
Registered: 2008-03-30
Posts: 354

Conky Clock Challenge

I have been trying off and on for a week now, to get the girl's hair piece to tell actual time. I just don't have the time to get this one done right. So I am turning to the visual wizards here on the forums for help!

My thought was to make the hands into fonts for conky to use, like the clock in the corner of the current screenshot. Adding to the difficulty is matching the time to the off angle of the headpiece. It would be bonus to make the second hand at the bottom of the headpiece work. My screen's resolution is 1280x800, so if scaling is an issue, that's the size I am looking for. I can make a "handless" background image if you want/need it.

If you end up not using conky, just let me know what programs are needed, and I can pacman them. It would be nice to keep an eye on memory lightness, if possible, since it is just background decoration. (That's why I went the conky route first.)

All of the relevant stuff... (Hands currently scaled to full sized image.)

The wallpaper:

tMnkzaQ

Current Screenshot:

tMnk0Yg

My hour hand GIMP:

tMnk0cg

My Minute hand:

tMnk0dA

Clock conkyrc:

# CONKY-CLOCK
# by: t-mo_

own_window yes
own_window_type desktop
own_window_transparent yes
#own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

double_buffer yes

#use_spacer right
use_xft yes
#xftalpha 0.1
update_interval 0.1
short_units yes

#maximum_width 500

draw_shades no

draw_outline no
draw_borders no
draw_graph_borders no
#xftfont clockfaces:size=110
#short_units no

#stippled_borders 3


#default_color white
#color1 e5e5e5
#color2 F1AA0E
#color3 white
#color4 white
#color5 white
#color6 white
#color7 white
#color8 white
#color9 white

#alignment top_left
#alignment top_right
alignment bottom_left
#alignment bottom_right
#alignment top_middle

gap_x -21
gap_y -400

#max_specials 256
#max_user_text 

text_buffer_size 2048

# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes

TEXT
${color #B7B0A5}${goto 23}${font zoraclockD:size=110}
${voffset -178}${goto 23}${font clockfaces:size=110}R
${color #B7B0A5}${voffset -156}${goto 30}${font zoraclockM:size=110}${execpi 20 date | cut -c15-16 | xargs /home/zedd/.bin/conky/fonts_scripts/clock.sh minute}${color d5d5d5}
${color #B7B0A5}${voffset -150}${goto 50}${font zoraclockH:size=80}${execpi 20 /home/zedd/.bin/conky/fonts_scripts/clock.sh hour}

Here is the clock.sh script:

#!/bin/sh
# clock.sh
# Written by Crinos512
# Original concept by t-mo_
#
# Usage: ${execpi 20 ~/.conky/conkyparts/clock.sh hour}
#         - or -
#        ${execpi 20 ~/.conky/conkyparts/clock.sh minute}

#Hour
case "$1" in
'hour')
  HOUR=`date +%H`
  MINUTE=`date +%M`
  case $HOUR in
    00 | 12)
      case $MINUTE in
        0[0-9] | 1[0-2]) echo "A" ;;
        1[3-9] | 2[0-2]) echo "B" ;;
        2[3-9] | 3[0-5]) echo "C" ;;
        3[6-9] | 4[0-8]) echo "D" ;;
        49 | 5[0-9]) echo "E" ;;
        *) echo "ERROR in Hour mod 00"   ;;
      esac
      ;;
    01 | 13)
      case $MINUTE in
        0[0-9] | 1[0-2]) echo "F" ;;
        1[3-9] | 2[0-2]) echo "G" ;;
        2[3-9] | 3[0-5]) echo "H" ;;
        3[6-9] | 4[0-8]) echo "I" ;;
        49 | 5[0-9]) echo "J" ;;
        *) echo "ERROR in Hour mod 01"   ;;
      esac
      ;;
    02 | 14)
      case $MINUTE in
        0[0-9] | 1[0-2]) echo "K" ;;
        1[3-9] | 2[0-2]) echo "L" ;;
        2[3-9] | 3[0-5]) echo "M" ;;
        3[6-9] | 4[0-8]) echo "N" ;;
        49 | 5[0-9]) echo "O" ;;
        *) echo "ERROR in Hour mod 02"   ;;
      esac
      ;;
    03 | 15)
      case $MINUTE in
        0[0-9] | 1[0-2]) echo "P" ;;
        1[3-9] | 2[0-2]) echo "Q" ;;
        2[3-9] | 3[0-5]) echo "R" ;;
        3[6-9] | 4[0-8]) echo "S" ;;
        49 | 5[0-9]) echo "T" ;;
        *) echo "ERROR in Hour mod 03"   ;;
      esac
      ;;
    04 | 16)
      case $MINUTE in
        0[0-9] | 1[0-2]) echo "U" ;;
        1[3-9] | 2[0-2]) echo "V" ;;
        2[3-9] | 3[0-5]) echo "W" ;;
        3[6-9] | 4[0-8]) echo "X" ;;
        49 | 5[0-9]) echo "Y" ;;
        *) echo "ERROR in Hour mod 04"   ;;
      esac
      ;;
    05 | 17)
      case $MINUTE in
        0[0-9] | 1[0-2]) echo "Z" ;;
        1[3-9] | 2[0-2]) echo "a" ;;
        2[3-9] | 3[0-5]) echo "b" ;;
        3[6-9] | 4[0-8]) echo "c" ;;
        49 | 5[0-9]) echo "d" ;;
        *) echo "ERROR in Hour mod 05"   ;;
      esac
      ;;
    06 | 18)
      case $MINUTE in
        0[0-9] | 1[0-2]) echo "e" ;;
        1[3-9] | 2[0-2]) echo "f" ;;
        2[3-9] | 3[0-5]) echo "g" ;;
        3[6-9] | 4[0-8]) echo "h" ;;
        49 | 5[0-9]) echo "i" ;;
        *) echo "ERROR in Hour mod 06"   ;;
      esac
      ;;
    07 | 19)
      case $MINUTE in
        0[0-9] | 1[0-2]) echo "j" ;;
        1[3-9] | 2[0-2]) echo "k" ;;
        2[3-9] | 3[0-5]) echo "l" ;;
        3[6-9] | 4[0-8]) echo "m" ;;
        49 | 5[0-9]) echo "n" ;;
        *) echo "ERROR in Hour mod 07"   ;;
      esac
      ;;
    08 | 20)
      case $MINUTE in
        0[0-9] | 1[0-2]) echo "o" ;;
        1[3-9] | 2[0-2]) echo "p" ;;
        2[3-9] | 3[0-5]) echo "q" ;;
        3[6-9] | 4[0-8]) echo "r" ;;
        49 | 5[0-9]) echo "s" ;;
        *) echo "ERROR in Hour mod 08"   ;;
      esac
      ;;
    09 | 21)
      case $MINUTE in
        0[0-9] | 1[0-2]) echo "t" ;;
        1[3-9] | 2[0-2]) echo "u" ;;
        2[3-9] | 3[0-5]) echo "v" ;;
        3[6-9] | 4[0-8]) echo "w" ;;
        49 | 5[0-9]) echo "x" ;;
        *) echo "ERROR in Hour mod 09"   ;;
      esac
      ;;
    10 | 22)
      case $MINUTE in
        0[0-9] | 1[0-2]) echo "y" ;;
        1[3-9] | 2[0-2]) echo "z" ;;
        2[3-9] | 3[0-5]) echo "1" ;;
        3[6-9] | 4[0-8]) echo "2" ;;
        49 | 5[0-9]) echo "3" ;;
        *) echo "ERROR in Hour mod 10"   ;;
      esac
      ;;
    11 | 23)
      case $MINUTE in
        0[0-9] | 1[0-2]) echo "4" ;;
        1[3-9] | 2[0-2]) echo "5" ;;
        2[3-9] | 3[0-5]) echo "6" ;;
        3[6-9] | 4[0-8]) echo "7" ;;
        49 | 5[0-9]) echo "8" ;;
        *) echo "ERROR in Hour mod 11"   ;;
      esac
      ;;
     *) echo "ERROR finding Hour"   ;;
  esac
  ;;

'minute')
  MINUTE=`date +%M`
  case $MINUTE in
    00) echo "A" ;;
    01) echo "B" ;;
    02) echo "C" ;;
    03) echo "D" ;;
    04) echo "E" ;;
    05) echo "F" ;;
    06) echo "G" ;;
    07) echo "H" ;;
    08) echo "I" ;;
    09) echo "J" ;;
    10) echo "K" ;;
    11) echo "L" ;;
    12) echo "M" ;;
    13) echo "N" ;;
    14) echo "O" ;;
    15) echo "P" ;;
    16) echo "Q" ;;
    17) echo "R" ;;
    18) echo "S" ;;
    19) echo "T" ;;
    20) echo "U" ;;
    21) echo "V" ;;
    22) echo "W" ;;
    23) echo "X" ;;
    24) echo "Y" ;;
    25) echo "Z" ;;
    26) echo "a" ;;
    27) echo "b" ;;
    28) echo "c" ;;
    29) echo "d" ;;
    30) echo "e" ;;
    31) echo "f" ;;
    32) echo "g" ;;
    33) echo "h" ;;
    34) echo "i" ;;
    35) echo "j" ;;
    36) echo "k" ;;
    37) echo "l" ;;
    38) echo "m" ;;
    39) echo "n" ;;
    40) echo "o" ;;
    41) echo "p" ;;
    42) echo "q" ;;
    43) echo "r" ;;
    44) echo "s" ;;
    45) echo "t" ;;
    46) echo "u" ;;
    47) echo "v" ;;
    48) echo "w" ;;
    49) echo "x" ;;
    50) echo "y" ;;
    51) echo "z" ;;
    52) echo "1" ;;
    53) echo "2" ;;
    54) echo "3" ;;
    55) echo "4" ;;
    56) echo "5" ;;
    57) echo "6" ;;
    58) echo "7" ;;
    59) echo "8" ;;
    *) echo "ERROR finding Minute" ;;
  esac
  ;;
esac
exit 0

I keep getting distracted from my webserver project...

huh? oooh...  shiny!

Offline

#2 2009-12-08 22:23:53

sand_man
Member
From: Australia
Registered: 2008-06-10
Posts: 2,164

Re: Conky Clock Challenge

Nice idea but I'm wondering whether conky is the right tool for the job.
Maybe a cairo-clock skin? (I have no idea how hard/easy they are to make)


neutral

Offline

#3 2009-12-11 00:51:09

LeoSolaris
Member
From: South Carolina
Registered: 2008-03-30
Posts: 354

Re: Conky Clock Challenge

Me either.   I have never messed with cairo-clock or it's skins. Only reason I thought of conky was because in theory this is do-able.    Not easy, but doable, especially now that conky can work with lua scripts. (Not that I know lua yet...)


I keep getting distracted from my webserver project...

huh? oooh...  shiny!

Offline

#4 2009-12-11 01:53:15

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: Conky Clock Challenge

I don't know if I would do this in conky myself (no idea what I would do it in), but if I were to, I would move the offsets out of the conkyrc and into the output of the script. To avoid dealing with the added complexity of muxing the cases, I would probably split this into two conkyrcs as well, which invoke separate scripts (one for hours, one for minutes). If you want to use bash (which, in my experience, is slow as fsck), I would make it as programmatically simple as possible, i.e. the hour script would simply be run once an hour to get the hour and then go through up to 24 cases to find the correct output. The same for the minutes with 60.

I would probably write another script to generate the case outputs of the hour and minute scripts to get rough starting positions and then tweak the static code for finer adjustments. In the end, the hour script would look something like this:

#!/bin/bash
case $(date +%H) in
  00) echo '${offset x0}{$voffset y0} A'
  01) echo '${offset x1}{$voffset y1} B'
...

where x0, y0, x1, etc are numbers that have all been calculated and possibly tweaked to align the "hands" as you want them.

Last edited by Xyne (2009-12-11 01:55:34)


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#5 2009-12-12 02:51:59

hesperaux
Member
From: Arizona, USA
Registered: 2009-12-12
Posts: 2
Website

Re: Conky Clock Challenge

I've made Cairo-Clock themes before. It's pretty easy. All you have to do is become familiar with inkscape. The cairo-clock themes use a series of SVG graphics that are layered on top of each other by cairo-clock. Just modifying the layers one at a time, until you have a complete theme change, is all you have to do. You can download one of my tarballs, untar it, and modify the SVGs right now if you like, or find another theme somewhere else. Here's a link to one of mine:
http://gnome-look.org/content/show.php/ … tent=74296

Good luck with the theme!
Oh, and obviously I agree with a couple of the previous posters... It would probably be more efficient to use cairo-clock for this. Conky tends to be slow at doing very intensive things, and lua is quite new. I would wait a while on that at least. Plus, you'd have to learn lua just to see if it's possible to do it, even if it probably is possible.

That's my opinion. Feel free to form-email me if you have any questions about cairo-clock themes. I can probably help you to some degree.

-Dave


I'm that guy that uses linux on certain apple products. But don't tell anyone, I'd be an outcast from every clique in the tech world.

Offline

#6 2009-12-12 03:38:25

pillz
Member
Registered: 2009-08-20
Posts: 58

Re: Conky Clock Challenge

I suggest using Cario-clock for this.  Seems like it would be a lot of effort to get it working right in conky.

Offline

#7 2009-12-12 19:25:51

LeoSolaris
Member
From: South Carolina
Registered: 2008-03-30
Posts: 354

Re: Conky Clock Challenge

Thanks guys/gals!

Xyne: I've done a limited amount of bash scripting, and I think your sentiments about bash being a little too slow for something like this are spot on. Thanks for the bash code pointers, though! I was planning on making the hands into fonts and reusing the clock script... (Which I think is the same, but I would have to look at it again)

hesperaux: I think I will give cairo-clock a whirl. I was willing to learn lua just to accomplish this, so cairo-clock can't be that much harder. I'll probably email you when I get stuck. How heavy on resources is cairo-clock?  My current conky clock is sitting at 0.3% of 2 Gb RAM.


I keep getting distracted from my webserver project...

huh? oooh...  shiny!

Offline

#8 2009-12-12 20:25:56

kaivalagi
Member
From: Norwich, UK
Registered: 2009-11-05
Posts: 145

Re: Conky Clock Challenge

Conky might be worthy for this task now that it supports lua and cairo bindings, just need to install the AUR version "conky-lua"

See this: http://conky.linux-hardcore.com/?page_id=2780

Simple clock but you get the idea...


Running Arch 64 (Made the switch to Arch 10/2009)
AUR | BZR

Offline

#9 2009-12-14 20:35:49

Shapeshifter
Member
Registered: 2008-03-11
Posts: 230

Re: Conky Clock Challenge

I liked your idea a lot...

so I made it smile For cairo-clock though, not for conky.

edit: improved version, deleted the old one. Like this one much better
You can download the cairo theme here.
And the wallpaper to be used with it is here(Simply removed the hands).

If you're using compiz, I noticed that compiz messes with window positioning when launching the clock. If you use compiz, go to the "Place windows" plugin and add this to the "Force Placement Windows" line:

!(class=Cairo-clock)

This might also be the case for any other advanced WM. You might also want to make cairo-clock "sticky" in your WM so that it appears on all work spaces.

Extract the tar to /usr/share/cairo-clock/themes. Now you can launch cairo-clock from the command line (and put it in .xinitrc and whatnot...) with for example:

cairo-clock -w 400 -h 400 -t time-oblivion -s -x 825 -y 103

Here's how it looks:
cairo-clock-sc.png

Though now that conky has cairo and lua support, it's really become a nice tool to display stuff in a nice way, more then ever.

Btw that wallpaper is pure win!

Last edited by Shapeshifter (2009-12-15 00:32:56)

Offline

#10 2009-12-21 03:58:14

LeoSolaris
Member
From: South Carolina
Registered: 2008-03-30
Posts: 354

Re: Conky Clock Challenge

I thought it was pretty cool, too. Thank ya for the cairo-clock edition!  I am still tinkering with the conky version, just to see if I can, but now I do not actually need to get it to work to make the desktop look right.

I am in the process of installing it, and I will write back sometime tomorrow once I get it in cairo-clock. (Holidays have 90% of my attention right now.)

Ok! Post holiday trial of this was really nice! Thank you for your work, it is excellent! By the way, why does cairo-clock always start in some random place on the screen? Is that a bug or a feature?

Regardless, it still turned out beautifully. All it needs is a little dragging around to get it in place when I start up. Not a big deal.

Have a great New Years!

Last edited by LeoSolaris (2009-12-30 15:03:03)


I keep getting distracted from my webserver project...

huh? oooh...  shiny!

Offline

Board footer

Powered by FluxBB