Skip to content

florianjacob/mezamashi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mezamashi - めざまし

A Terminal Alarm Clock written in Python

Regular alarm clocks have the disadvantage of not turning off your computer when it's time to sleep, they just beep when it's time to get up.

To prevent you from finishing "just this little thing" and getting to bed too late, you can set up mezamashi to shut down your computer at a specific time beforehand, e.g. in 2 hours, and to wake you up with a nice song in your media player or anything else you can steer from the command line.

But the crucial point is that it turns on your computer when it's time to get up and lets you know that - so it uses the force that keeps you at your computer and out of bed at bedtime to get you out of bed (and, unfortunately, at the computer again) when it's time to get up.

The only thing left for you is to get out of the house in time, but at least your early-morning sleapyness shouldn't make you stay in bed anymore. ;)

Commands:

Usage: mezamashi.py command [options]

Options:
  -h, --help  show this help message and exit

Commands:
  show   show the current alarm time
  sleep  set the time to suspend the computer
  set    set the alarm time.
  unset  unset the current alarm

Example usage

# set a wakeup alarm to 8 o'clock
>./mezamashi.py set 8:00
# show the current alarm
>./mezamashi.py show
# disable the current alarm
>./mezamashi.py unset
# set a wakeup alarm in 7 hours and a half
>./mezamashi.py set 7h30
# go to sleep in 20 minutes. you need to use this command to suspend to run your alarm_shcommand at next startup.
>./mezamashi.py sleep 0h20
# there's an alias if you want to suspend immediatly
>./mezamashi.py sleep now

Installation / Requirements

mezamashi needs:

  • python (version 2, didn't test version 3)
  • sudo
  • pip (or easy_install) to get scriptine

mezamashi doesn't need rtcwake anymore, it now talks to your realtime clock via the /sys/-interface.

sudo pip install scriptine
sudo easy_install scriptine

Configuration

You need to set your alarm command (what you want to have executed when you want to wake up) in the config file at ~/.config/mezamashi.conf. This file will be autogenerated on first run if it doesn't already exist.

What gets used for suspend (systemctl by default) and what real time clock is used (/sys/class/rtc/rtc0) can be configured in the config file.

mezamashi needs your hardware clock to be on UTC, as I don't want to deal with damn daylight saving time and having your hardware clock in UTC is the strongly recommended way on Linux in general.

This is completely independent of your user clock being in whatever timezone and daylight saving time you want it to be. Your system will add the appropriate offsets for the timezone you configured to the hardware clock when showing you your user time.

To check this, run:

timedatectl

and search for the line:

 RTC in local TZ: no

If it says 'yes', correct this with:

timedatectl --adjust-system-clock set-local-rtc no

mezamashi uses the scriptine python module for command parsing and execution, make sure it's installed with

Licensing

mezamashi is licensed under the General Public License version 3, the text of which can be found in LICENSE, or any later version of the GPL, unless otherwise noted.

Licensing of used libraries:

Attribution

mezamashi is written by Florian Jacob.

Name

mezamashi is the japanese word for alarm clock. 'wecker', the german word, was already taken, so I chose mezamashi to make me remember a vocable without doing anything for it. ;)

About

A Terminal Alarm Clock written in Python.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages