Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to specify how many "hours" to remain active: caff 2h #4

Merged
merged 1 commit into from
Mar 12, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion source.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
### Controls ####
# on
# 5
# 2h
# off
# quit or end or exit or kill
# start or init
# no argument will toggle Caffeine on and off
################################
# On Indefinitely: caff on
# On for 5 Minutes: caff 5
# On for 2 Hours: caff 2h
# Off: caff off
# Quit App: caff quit or caff end or caff exit or caff kill
# Start App: caff start or caff init
Expand All @@ -33,7 +35,15 @@ on sendMsg(msg)
end sendMsg

on alfred_script(q)

-- add hours-detection here
if q contains "h" then
set text item delimiters to "h"
set hours to text item 1 of q
if hours > 0 then
set q to (hours * 60)
end if
end if
-- original code below
set msg to ""
set s to {"start", "init"}
set e to {"quit", "kill", "end", "exit"}
Expand Down