Skip to content
This repository has been archived by the owner on Jun 10, 2022. It is now read-only.

Commit

Permalink
initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Frozenfire92 committed Jul 7, 2014
0 parents commit 17e7063
Show file tree
Hide file tree
Showing 13 changed files with 219 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
npm-debug.log
node_modules
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.1.0 - First Release
* Every feature added
* Every bug fixed
24 changes: 24 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

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 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.

For more information, please refer to <http://unlicense.org/>
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# break;

An [Atom]() package to remind you to get up, move around, and take a break.
Inspired by [Workrave](http://www.workrave.org/), [countless articles](https://www.google.ca/#q=sitting+harmful), and my sore hips.

![A screenshot of your spankin' package](https://f.cloud.github.com/assets/69169/2290250/c35d867a-a017-11e3-86be-cd7c5bf3ff9b.gif)
11 changes: 11 additions & 0 deletions keymaps/break.cson
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Keybindings require three things to be fully defined: A selector that is
# matched against the focused element, the keystroke and the command to
# execute.
#
# Below is a basic keybinding which registers on all platforms by applying to
# the root workspace element.

# For more detailed documentation see
# https://atom.io/docs/latest/advanced/keymaps
'.workspace':
'ctrl-alt-o': 'break:toggle'
34 changes: 34 additions & 0 deletions lib/break-view.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{View} = require 'atom'

module.exports =
class BreakView extends View
@content: ->
# The full screen overlay
@div class: 'overlay from-top floating break', =>
# Panel in the center
@div class: "panel bordered vertical-center", =>
@div class: "panel-heading text-center", =>
@h4 class: 'actual-heading', 'Time to take a break;'
@div class: "panel-body padded", =>
# Quote
@p class: 'text-center', 'Whatever the mind of man can conceive and believe, it can achieve. – Napoleon Hill'
# Progress Bar
@div class: 'block', =>
@progress class: 'inline-block widen', max: '100', value: '10'

initialize: (serializeState) ->
atom.workspaceView.command "break:toggle", => @toggle()

# Returns an object that can be retrieved when package is activated
serialize: ->

# Tear down any state and detach
destroy: ->
@detach()

toggle: ->
console.log "BreakView was toggled!"
if @hasParent()
@detach()
else
atom.workspaceView.append(this)
34 changes: 34 additions & 0 deletions lib/break.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
BreakView = require './break-view'

module.exports =
breakView: null
# In miliseconds
breakInterval: 300000 # 5 minute default
breakLength: 60000 # 1 minute defualt

activate: (state) ->
# Start Timer
@timer()


deactivate: ->
@breakView.destroy()

serialize: ->
breakViewState: @breakView.serialize()

timer: ->
# Start interval countdown

# Activate break view
@breakView = new BreakView(state.breakViewState)

# Start break countdown
# Get random quote
# Update progress bar

# Deactive break view
@deactivate()

# Restart
@timer()
Empty file added lib/quotes.json
Empty file.
16 changes: 16 additions & 0 deletions menus/break.cson
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# See https://atom.io/docs/latest/creating-a-package#menus for more details
'context-menu':
'.overlayer':
'Enable break': 'break:toggle'

'menu': [
{
'label': 'Packages'
'submenu': [
'label': 'break'
'submenu': [
{ 'label': 'Toggle', 'command': 'break:toggle' }
]
]
}
]
19 changes: 19 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "break",
"author": {
"name": "Joel Kuntz",
"email": "[email protected]",
"url": "https://github.com/Frozenfire92/"
},
"main": "./lib/break",
"version": "0.1.0",
"description": "A reminder to take a break;",
"activationEvents": ["break:toggle"],
"repository": "https://github.com/Frozenfire92/break",
"license": "unlicense",
"engines": {
"atom": ">0.50.0"
},
"dependencies": {
}
}
30 changes: 30 additions & 0 deletions spec/break-spec.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{WorkspaceView} = require 'atom'
Break = require '../lib/break'

# Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
#
# To run a specific `it` or `describe` block add an `f` to the front (e.g. `fit`
# or `fdescribe`). Remove the `f` to unfocus the block.

describe "Break", ->
activationPromise = null

beforeEach ->
atom.workspaceView = new WorkspaceView
activationPromise = atom.packages.activatePackage('break')

describe "when the break:toggle event is triggered", ->
it "attaches and then detaches the view", ->
expect(atom.workspaceView.find('.break')).not.toExist()

# This is an activation event, triggering it will cause the package to be
# activated.
atom.workspaceView.trigger 'break:toggle'

waitsForPromise ->
activationPromise

runs ->
expect(atom.workspaceView.find('.break')).toExist()
atom.workspaceView.trigger 'break:toggle'
expect(atom.workspaceView.find('.break')).not.toExist()
5 changes: 5 additions & 0 deletions spec/break-view-spec.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
BreakView = require '../lib/break-view'

describe "BreakView", ->
it "has one valid test", ->
expect("life").toBe "easy"
34 changes: 34 additions & 0 deletions stylesheets/break.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// The ui-variables file is provided by base themes provided by Atom.
//
// See https://github.com/atom/atom-dark-ui/blob/master/stylesheets/ui-variables.less
// for a full listing of what's available.
@import "ui-variables";

.break {
margin: 0 auto;
height: 100%;
width: 100%;
}

.text-center {
text-align: center;
}

.widen {
position: absolute;
margin: auto;
width: 95%;
bottom: 10px;
}

.actual-heading {
font-size: 3em;
}

.vertical-center {
width: 50%;
height: 50%;
margin: auto;
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
}

0 comments on commit 17e7063

Please sign in to comment.