forked from dtinth/tabe25m
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d42547d
Showing
7 changed files
with
177 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.DS_Store | ||
npm-debug.log | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Copyright (c) 2016 <Your name here> | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# TABE25M | ||
|
||
THIS ATOM PLUGIN WILL FORCE YOU TO __TAKE A BREAK EVERY 25 MINUTES.__ EACH BREAK LASTS 5 MINUTES. INSPIRED BY THE POMODORO TECHNIQUE. | ||
I CREATED THIS PLUGIN BECAUSE I FOUND MYSELF CODING NONSTOP FOR HOURS. | ||
THIS IS NOT A HEALTHY HABIT AND IT HURTS MY EYES, JUST LIKE A WALL OF ALL CAPITALIZED TEXT YOU ARE READING HERE. | ||
|
||
## USAGE | ||
|
||
### TYPING IN ATOM WILL SET A 25 MINUTES TIMER | ||
|
||
### AS THE BREAK TIME APPROACHES, A REMINDER WILL APPEAR. | ||
|
||
![REMINDER](http://i.imgur.com/xT0oj1m.png) | ||
|
||
### THE REMINDER INTENSIFIES AS THE BREAK APPROACHES | ||
|
||
![IT’S COMING!!](http://i.imgur.com/83Ovow8.png) | ||
|
||
### THEN IT COMPLETELY FILLS YOUR SCREEN, FORCING YOU TO TAKE A BREAK | ||
|
||
![IT’S BREAK TIME!!!](http://i.imgur.com/swpzNWh.png) | ||
|
||
### ALL ATOM WINDOWS ARE LOCKED AT THE SAME TIME, SO YOU CANNOT SWITCH TO ANOTHER WINDOW DURING THE BREAK. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
'use babel' | ||
|
||
import { CompositeDisposable } from 'atom' | ||
|
||
const TAKE_A_BREAK_EVERY = 25 * 60 * 1000 | ||
const TAKE_A_BREAK_FOR = 5 * 60 * 1000 | ||
const WARN_ME_BEFORE_BREAK_BY = 3 * 60 * 1000 | ||
|
||
function sideEffect (value, onChange) { | ||
return function (nextValue) { | ||
if (nextValue !== value) { | ||
value = nextValue | ||
onChange(value) | ||
} | ||
} | ||
} | ||
|
||
export default { | ||
config: { | ||
nextBreakTime: { | ||
type: 'integer', | ||
default: 0 | ||
} | ||
}, | ||
activate(state) { | ||
this.nextBreak = 0 | ||
this.element = document.createElement('div') | ||
this.element.className = 'tabe25m-view' | ||
this.text = document.createElement('div') | ||
this.text.innerHTML = 'YOU SHOULD TAKE A BREAK' | ||
this.element.appendChild(this.text) | ||
this.subscriptions = new CompositeDisposable() | ||
this.interval = setInterval(() => this.checkTimer(), 1000) | ||
this.subscriptions.add(atom.workspace.observeTextEditors((textEditor) => { | ||
this.subscriptions.add(textEditor.onDidChange(() => this.triggerTextChange())) | ||
})) | ||
this.subscriptions.add(atom.config.observe('tabe25m.nextBreakTime', (value) => { | ||
this.nextBreak = value | ||
})) | ||
this.setHidden = sideEffect(false, (hidden) => { | ||
this.element.style.display = hidden ? 'none' : 'block' | ||
}) | ||
this.setOpacity = sideEffect(1, (opacity) => { | ||
this.element.style.opacity = opacity | ||
}) | ||
this.setText = sideEffect('', (text) => { | ||
this.text.innerHTML = text | ||
}) | ||
this.checkTimer() | ||
document.body.appendChild(this.element) | ||
}, | ||
triggerTextChange () { | ||
if (Date.now() > this.nextBreak + TAKE_A_BREAK_FOR) { | ||
this.nextBreak = Date.now() + TAKE_A_BREAK_EVERY | ||
atom.config.set('tabe25m.nextBreakTime', this.nextBreak) | ||
} | ||
}, | ||
checkTimer () { | ||
const timeLeft = this.nextBreak - Date.now() | ||
if (timeLeft < 0) { | ||
const breakLeft = timeLeft + TAKE_A_BREAK_FOR | ||
if (breakLeft > 0) { | ||
this.setHidden(false) | ||
this.setOpacity(1) | ||
const minutes = Math.ceil(breakLeft / 60000) | ||
this.setText('YOU SHOULD TAKE A BREAK<br>' + minutes + ' MORE MINUTE' + (minutes === 1 ? '!' : 'S')) | ||
} else { | ||
this.setHidden(breakLeft < -2000) | ||
this.setOpacity(0) | ||
} | ||
} else if (timeLeft < WARN_ME_BEFORE_BREAK_BY) { | ||
const warnIntensity = 1 - (timeLeft / WARN_ME_BEFORE_BREAK_BY) | ||
this.setHidden(false) | ||
this.setOpacity(Math.pow(warnIntensity, 3)) | ||
this.setText('GET READY TO TAKE A BREAK') | ||
} else { | ||
this.setHidden(true) | ||
this.setOpacity(0) | ||
} | ||
}, | ||
deactivate() { | ||
this.element.parentNode.removeChild(this.element) | ||
this.subscriptions.dispose() | ||
clearInterval(this.interval) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "tabe25m", | ||
"main": "./lib/tabe25m", | ||
"version": "0.0.0", | ||
"description": "TAKE A BREAK EVERY 25 MINUTES", | ||
"keywords": [ | ||
], | ||
"repository": "https://github.com/dtinth/tabe25m", | ||
"license": "MIT", | ||
"engines": { | ||
"atom": ">=1.0.0 <2.0.0" | ||
}, | ||
"dependencies": { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// The ui-variables file is provided by base themes provided by Atom. | ||
// | ||
// See https://github.com/atom/atom-dark-ui/blob/master/styles/ui-variables.less | ||
// for a full listing of what's available. | ||
@import "ui-variables"; | ||
|
||
.tabe25m-view { | ||
position: fixed; | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
z-index: 999999999; | ||
pointer-events: none; | ||
background: fadeout(@app-background-color, 0%); | ||
color: @text-color; | ||
text-align: center; | ||
font-size: 5vw; | ||
transition: 1s opacity linear; | ||
> div { | ||
position: absolute; | ||
top: 50%; | ||
left: 0; | ||
right: 0; | ||
transform: translateY(-50%); | ||
} | ||
} |