master 3f08bab53c5c cached
9 files
9.1 KB
2.6k tokens
5 symbols
1 requests
Download .txt
Repository: dbader/alfred-countdown-timer
Branch: master
Commit: 3f08bab53c5c
Files: 9
Total size: 9.1 KB

Directory structure:
gitextract_5y6o__cd/

├── .gitignore
├── LICENSE.txt
├── README.md
├── Timer/
│   ├── LICENSE.txt
│   ├── alarm.m4a
│   ├── info.plist
│   ├── kudos.plist
│   └── timer.py
└── Timer.alfredworkflow

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
*.py[cod]

# C extensions
*.so

# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64

# Installer logs
pip-log.txt

# Unit test / coverage reports
.coverage
.tox
nosetests.xml

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject


================================================
FILE: LICENSE.txt
================================================
The MIT License (MIT)

Copyright (c) 2013 Daniel Bader

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


================================================
FILE: README.md
================================================
# [A countdown timer extension for Alfred.app](http://dbader.org/blog/alfred-timer-extension)
A simple countdown timer command for [Alfred.app](http://www.alfredapp.com/) that uses Mountain Lion User Notifications.

![Demo screenshot](https://raw.github.com/dbader/alfred-countdown-timer/master/screenshot.png)

The extension is described in closer detail on my [blog](http://dbader.org/blog/alfred-timer-extension).

## Benefits
- Helps you make great tea.
- Solves your [Pomodoro](http://en.wikipedia.org/wiki/Pomodoro_Technique) needs.
- Uses Mountain Lion's User Notifications to tell you when time's up.
- Plays a non-intrusive alarm sound.
- Allows you to run multiple timers at the same time.
- Allows you to add an optional label to the timer, e.g. "Laundry is done!". Thanks to [Alexander Lehmann](http://rudairandamacha.blogspot.de) for the suggestion.
- Shows you how to write Alfred extensions in Python.

## Installation
- Download [Timer.alfredworkflow](https://github.com/dbader/alfred-countdown-timer/blob/master/Timer.alfredworkflow?raw=true)
- Double-click `Timer.alfredworkflow` to install the extension.

To use this extension you need [Alfred.app](http://www.alfredapp.com/) for macOS and the [Alfred PowerPack](http://www.alfredapp.com/powerpack/).

## Usage
- The general syntax is `timer [minutes] [optional:title]`
- `timer 5` sets a countdown timer that goes off after 5 minutes.
- `timer 0:30` or `timer 0.5` sets a timer that goes off after 30 seconds.
- `timer 40 Laundry is done!` adds an optional title to the timer.
- `timer` displays usage information.

## Meta

Daniel Bader – [@dbader_org](https://twitter.com/dbader_org) – mail@dbader.org

Distributed under the MIT license. See ``LICENSE.txt`` for more information.

https://github.com/dbader/alfred-countdown-timer


================================================
FILE: Timer/LICENSE.txt
================================================
The icon is from ~MazeNL77's "nx10" icon set.

The sound is "Ice" from Nitram+Nunca's awesome "Minutes" dashboard widget.
Sadly, the company seems to have vanished. I love this sound and use
it on all my devices as an alarm sound. So Nitram+Nunca, I hope it is okay
for you that I include your sound file. If not please contact me and I will
take it offline.

The rest of the project is released under the MIT license.


Copyright (c) 2013 Daniel Bader (http://dbader.org)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


================================================
FILE: Timer/info.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>action</key>
	<false/>
	<key>category</key>
	<string>SCRIPTS</string>
	<key>command</key>
	<string>python timer.py {query}</string>
	<key>disabled</key>
	<false/>
	<key>escapedollar</key>
	<false/>
	<key>escapequery</key>
	<false/>
	<key>escapequerybackquotes</key>
	<true/>
	<key>escapequerybrackets</key>
	<true/>
	<key>escapequeryquotes</key>
	<true/>
	<key>escapequerysemicolons</key>
	<true/>
	<key>growloutput</key>
	<true/>
	<key>growloutputsticky</key>
	<true/>
	<key>keyword</key>
	<string>timer</string>
	<key>logging</key>
	<false/>
	<key>multifileargs</key>
	<false/>
	<key>parameter</key>
	<integer>0</integer>
	<key>silent</key>
	<true/>
	<key>subtitle</key>
	<string>Example: timer 5:30</string>
	<key>title</key>
	<string>Start a countdown timer</string>
</dict>
</plist>


================================================
FILE: Timer/kudos.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>creator</key>
	<string>Daniel Bader</string>
	<key>website</key>
	<string>http://dbader.org/blog/alfred-timer-extension</string>
</dict>
</plist>


================================================
FILE: Timer/timer.py
================================================
#!/usr/bin/env python3

"""
A simple countdown timer command for Alfred.app that
uses Mountain Lion User Notifications.

Copyright (c) 2013 Daniel Bader (http://dbader.org)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"""

import json
import os
import subprocess
import sys
import time


def main(argv):
    interval = parse_time(argv)
    minutes = interval / 60
    seconds = interval % 60

    label = ' '.join(argv[1:])
    title = 'Timer started' + (': %s' % label.capitalize() if label else '.')

    if minutes and seconds:
        notify(title, "I'll notify you in %i:%.2i." % (minutes, seconds))
        passed_time = '%i:%.2i have passed.' % (minutes, seconds)
    elif minutes:
        notify(title, "I'll notify you in %i %s." % (minutes,
               'minute' if minutes == 1 else 'minutes'))
        passed_time = '%i %s passed.' % (minutes,
                      'minute has' if minutes == 1 else 'minutes have')
    else:
        notify(title, "I'll notify you in %i seconds." % seconds)
        passed_time = '%i seconds have passed.' % seconds

    time.sleep(interval)
    notify("Time's up" + (': %s' % label.capitalize() if label else '.'),
           passed_time)
    play_sound('alarm.m4a')


def parse_time(argv):
    """Parse and return the desired countdown duration in seconds from
    the commandline.
    """
    try:
        duration = argv[0]
        if ':' in duration:
            # Minutes and seconds, e.g. "5:30"
            minutes, seconds = duration.split(':')
            return int(minutes) * 60 + int(seconds)
        else:
            # Just minutes, e.g. "1.5"
            return int(float(duration) * 60)
    except:
        show_usage()
        sys.exit(1)


def show_usage():
    notify('Timer usage', 'timer [minutes] [optional: title]')


def notify(title, text=None):
    subprocess.Popen([
        'osascript', 
        '-e', 
        f'''tell application id "com.runningwithcrayons.Alfred" to run trigger "notification" in workflow "org.dbader.alfred.timer" with argument "{title}|||{text}"'''
    ])


def play_sound(filename):
    """Play the given sound file using the `afplay` command line utility."""
    subprocess.Popen(['afplay', filename])


if __name__ == '__main__':
    if len(sys.argv) > 1:
        argv = sys.argv[1].split()
    else:
        argv = []
    main(argv)
Download .txt
gitextract_5y6o__cd/

├── .gitignore
├── LICENSE.txt
├── README.md
├── Timer/
│   ├── LICENSE.txt
│   ├── alarm.m4a
│   ├── info.plist
│   ├── kudos.plist
│   └── timer.py
└── Timer.alfredworkflow
Download .txt
SYMBOL INDEX (5 symbols across 1 files)

FILE: Timer/timer.py
  function main (line 35) | def main(argv):
  function parse_time (line 61) | def parse_time(argv):
  function show_usage (line 79) | def show_usage():
  function notify (line 83) | def notify(title, text=None):
  function play_sound (line 91) | def play_sound(filename):
Condensed preview — 9 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (10K chars).
[
  {
    "path": ".gitignore",
    "chars": 303,
    "preview": "*.py[cod]\n\n# C extensions\n*.so\n\n# Packages\n*.egg\n*.egg-info\ndist\nbuild\neggs\nparts\nbin\nvar\nsdist\ndevelop-eggs\n.installed."
  },
  {
    "path": "LICENSE.txt",
    "chars": 1079,
    "preview": "The MIT License (MIT)\n\nCopyright (c) 2013 Daniel Bader\n\nPermission is hereby granted, free of charge, to any person obta"
  },
  {
    "path": "README.md",
    "chars": 1803,
    "preview": "# [A countdown timer extension for Alfred.app](http://dbader.org/blog/alfred-timer-extension)\nA simple countdown timer c"
  },
  {
    "path": "Timer/LICENSE.txt",
    "chars": 1497,
    "preview": "The icon is from ~MazeNL77's \"nx10\" icon set.\n\nThe sound is \"Ice\" from Nitram+Nunca's awesome \"Minutes\" dashboard widget"
  },
  {
    "path": "Timer/info.plist",
    "chars": 965,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "Timer/kudos.plist",
    "chars": 323,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "Timer/timer.py",
    "chars": 3315,
    "preview": "#!/usr/bin/env python3\n\n\"\"\"\nA simple countdown timer command for Alfred.app that\nuses Mountain Lion User Notifications.\n"
  }
]

// ... and 2 more files (download for full content)

About this extraction

This page contains the full source code of the dbader/alfred-countdown-timer GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 9 files (9.1 KB), approximately 2.6k tokens, and a symbol index with 5 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!