Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Looking for countdown... thing.

  1. #1
    Join Date
    Apr 2010
    Location
    Wacken!
    Beans
    31
    Distro
    Ubuntu 10.04 Lucid Lynx

    Looking for countdown... thing.

    Allow me to elaborate.
    My dad asked me whether there was a program that would show him, on his desktop if possible, just how long it is yet until April 2031, the month he may finally retire. Since this seems to me like a relatively simple program (I guess I could do it myself, if I knew the proper language) I am fairly certain it does exist somewhere, but as of now I was unable to find anything that would be of actual use.
    10 PRINT "HAHA!"
    20 GOTO 10

  2. #2
    Join Date
    Mar 2012
    Location
    Figueres, Alt Empordą
    Beans
    65
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Looking for countdown... thing.

    Could you try this screenlet? It's implemented in GTK 2.x and I see you use Ubuntu 10.04. I can't test it since I use Ubuntu 12.04 (GTK 3.X). I am also interested in this feature.

    http://gnome-look.org/content/show.p...content=140959


    I've been searching in Google and I've seen that there're iphone (http://www.timeanddate.com/countdown/create) and android apps (https://play.google.com/store/apps/d...id=smsr.com.cw) to do that, but not an easy one for Ubuntu...

  3. #3
    Join Date
    Apr 2010
    Location
    Wacken!
    Beans
    31
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Looking for countdown... thing.

    Works for me. Though my dad does NOT use Lucid, I think he's on 11.04 right now. Well, can't hurt to try now, can it?
    10 PRINT "HAHA!"
    20 GOTO 10

  4. #4
    Join Date
    Mar 2012
    Beans
    782
    Distro
    Ubuntu Development Release

    Re: Looking for countdown... thing.

    No, you can always change it back to previous state. But I am pretty sure it will work.

    Regards.

    I DON'T EVEN KNOW WHAT A QUANTAL QUETZAL IS...BUT IT SOUNDS LIKE PRETZEL AND I LIKE PRETZEL

  5. #5
    Join Date
    Mar 2012
    Location
    Figueres, Alt Empordą
    Beans
    65
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Looking for countdown... thing.

    It won't work in my case (Ubuntu 12.04)

    What might I have done wrong?

  6. #6
    Join Date
    Oct 2008
    Beans
    3,509

    Re: Looking for countdown... thing.

    You can use a script with conky to display a countdown.

    Install conky and you may need to install libdate-manip-perl
    Code:
    sudo apt-get install conky-all libdate-manip-perl
    Save this as howlong.pl in your home folder.
    After saving, right click on the file
    Properties > Permissions
    and mark as executable.
    Code:
    #!/usr/bin/perl
    #Script Name: howLong.pl
    #Author: Nathan Handler <nhandler @ubuntu.com>
     
    use strict;
    use warnings;
    use Date::Manip;
     
    my $target=$ARGV[0] || "April 1, 2031";
    my $delta = DateCalc(ParseDate("now"),ParseDate($target),1);
     
    $delta=~s/^[+-]//;
    my($y,$m,$w,$d,$h,$min,$s) = split(/:/,$delta,7);
    
    $y = sprintf("%02d", $y);
    $m = sprintf("%02d", $m);
    $w = sprintf("%02d", $w);
    $d = sprintf("%02d", $d);
    $h = sprintf("%02d", $h);
    $min = sprintf("%02d", $min);
    $s = sprintf("%02d", $s);
     
    print $y . "y " if($y>0);
    print $m . "m " if($m>0);
    print $w . "w " if($w>0);
    print $d . "d " if($d>0);
    #print "$h:$min:$s" if($h>0||$min>0||$s>0);</nhandler>

    Save this as .conkyrc in your home folder.(Include the preceding dot when saving.)
    Code:
    double_buffer yes
    background no
    no_buffers yes
    draw_outline no
    draw_shades no
    update_interval 30
    out_to_console no
    out_to_stderr no
    
    # Window Placement & Size
    alignment br
    own_window yes
    own_window_type normal
    own_window_transparent no
    own_window_argb_visual yes
    own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
    own_window_colour 000000
    
    gap_x 0
    gap_y 0
    minimum_size 
    maximum_width 
    
    #Text Formatting
    use_xft yes
    xftfont Ubuntu Mono:size=13
    
    
    TEXT
    ${pre_exec ~/howLong.pl}
    To test, open a terminal and run
    Code:
    conky
    Add to startup applications using
    Code:
    conky -p 10
    Attached Images Attached Images
    Last edited by stinkeye; July 9th, 2012 at 09:11 PM.

  7. #7
    Join Date
    Mar 2012
    Beans
    782
    Distro
    Ubuntu Development Release

    Re: Looking for countdown... thing.

    @Stinkeye what does this -p 10 in your attachments. Is this delay?

    I DON'T EVEN KNOW WHAT A QUANTAL QUETZAL IS...BUT IT SOUNDS LIKE PRETZEL AND I LIKE PRETZEL

  8. #8
    Join Date
    Oct 2008
    Beans
    3,509

    Re: Looking for countdown... thing.

    Quote Originally Posted by GreatDanton View Post
    @Stinkeye what does this -p 10 in your attachments. Is this delay?
    Yesiree.
    Delays the start of conky 10 secs so as it doesn't load before the window manager.

  9. #9
    Join Date
    Feb 2011
    Location
    new york state
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Looking for countdown... thing.

    EDITING DONT USE YET

    if you would like here is a bash script
    Code:
    #!/usr/bin/env bash 
    ##sanity check 
    if 
    [ "$#" -lt "2" ] ; then         
    echo "Incorrect usage ! Example:"         
    echo './countdown -d  "April 1, 2031 00:00"'         
    echo 'or'         
    echo './countdown -m  90'         
    exit 1 
    fi 
    ##setting up the varibles for 1
    now=`date +%s` 
    if [ "$1" = "-d" ] ; then         
    until=`date -d "$2" +%s`         
    sec_rem=`expr $until - $now`         
    echo "-d"
    ## is the time allready done ?          
    if [ $sec_rem -lt 1 ]; then                 
    echo "$2 is already history !"         
    fi fi 
    if [ "$1" = "-m" ] ; then         
    until=`expr 60 \* $2`         
    until=`expr $until + $now`         
    sec_rem=`expr $until - $now`         
    echo "-m"         
    if [ $sec_rem -lt 1 ]; then                 
    echo "$2 is already history !"         
    fi fi 
    ##start the loop 
    while [ $sec_rem -gt 0 ]; do         
    clear         
    date         
    let sec_rem=$sec_rem-1         
    interval=$sec_rem         
    seconds=`expr $interval % 60`         
    interval=`expr $interval - $seconds`         
    minutes=`expr $interval % 3600 / 60`         
    interval=`expr $interval - $minutes`         
    hours=`expr $interval % 86400 / 3600`         
    interval=`expr $interval - $hours`         
    days=`expr $interval % 86400000 / 86400`         
    interval=`expr $interval - $hours`         
    ## Add the function to print to screen
    function toscreen(){
    echo "----------------------------"         
    echo "I got me the Goal in"         
    echo "----------------------------"         
    echo "Days:    " $days         
    echo "Hours:   " $hours         
    echo "Minutes: " $minutes         
    echo "Seconds: " $seconds         
    sleep 1
    }
    toscreen
    done
    I will try to make gui for it.
    Power tends to corrupt, and absolute power corrupts absolutely. Great men are almost always bad men, even when they exercise influence and not authority

  10. #10
    Join Date
    Apr 2010
    Location
    Wacken!
    Beans
    31
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Looking for countdown... thing.

    Uhm, yeah. Alright. For me it is solved, the screenlet worked for my dad, all is fine. So there's that. Though that conky script does look a hell of a lot more elegant a solution I must say. I may try that for a Wacken countdown. Bit more reasonable than 19 years if you ask me.
    10 PRINT "HAHA!"
    20 GOTO 10

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •