You are not logged in.

#1 2015-12-08 12:43:21

sie
Member
From: Latvia
Registered: 2010-06-30
Posts: 33

nap: a more natural alarm clock command line interface

Given there's the nice rtcwake(8) utility, we can make computer act as an alarm clock if we summon a music player upon awakening.

But multiplying hours in bash before bedtime with $(( 3.5 * 3600 )) isn't my favorite thing, I'd much rather use a crystal clear interface that doesn't require any thinking at all.

I made one!

% # My typical usecase:

% nap until 10am; mpc toggle


% nap
    Usage: nap { for <float>[<h|m|s>] | until <date(1) parsable datestr> }
    e.g.  nap for 3h
        nap until 10AM

% nap for 5.3m
    sudo rtcwake -m mem -s 318

% date
    Tue Dec  8 14:30:45 EET 2015

% nap until '10am'
    # Tue Dec  8 10:00:00 EET 2015
    sudo rtcwake -m mem -t 1449561600


% # Error handling:

% nap for '5.5.m'
    # date format bogus
    sudo rtcwake -m mem -s 330

% nap until 'gibberish'
    date: invalid date ‘gibberish’

P.S. either run this as root or setup a password-less rtcwake.


a &

Offline

#2 2015-12-08 16:13:44

parchd
Member
Registered: 2014-03-08
Posts: 421

Re: nap: a more natural alarm clock command line interface

I love it! I didn't even know my computer could do that!

Offline

#3 2015-12-11 00:59:43

chilicuil
Member
Registered: 2014-03-22
Posts: 7
Website

Re: nap: a more natural alarm clock command line interface

Related to this I coded a couple of months ago a dmenu based alarm.

https://github.com/minos-org/minos-tool … -countdown

rtcwake is awesome smile

Offline

Board footer

Powered by FluxBB