A timer that automatically locks the screen to take a break away from the computer?
I'm looking for a graphical or command line program that provides me with the following workflow:
- Start a 25min session
- After 25min screen is automatically locked for 5min (or maybe just turned black?)
- Now I'm helped to take a break because I cannot do anything in front of the computer other than looking at a black or locked screen :)
- After 5min, the screen automatically returns and I can continue work
Is there a program that does exactly this?
software-recommendation lock-screen
add a comment |
I'm looking for a graphical or command line program that provides me with the following workflow:
- Start a 25min session
- After 25min screen is automatically locked for 5min (or maybe just turned black?)
- Now I'm helped to take a break because I cannot do anything in front of the computer other than looking at a black or locked screen :)
- After 5min, the screen automatically returns and I can continue work
Is there a program that does exactly this?
software-recommendation lock-screen
As a default feature you mean?
– orschiro
Nov 12 '15 at 7:52
Hi orschiro, it' s done! See latest edit...
– Jacob Vlijm
Dec 3 '15 at 13:01
@JacobVlijm just installed the PPA version. What a beautiful application you created. Thanks again so much!
– orschiro
Dec 5 '15 at 9:34
@orschiro Thank you for the nice question! It was really great fun to work on, and please if you find bugs or if you have suggestions, don't hesitate to mention it on launchpad (either the bug-link or the question-link).
– Jacob Vlijm
Dec 5 '15 at 10:15
add a comment |
I'm looking for a graphical or command line program that provides me with the following workflow:
- Start a 25min session
- After 25min screen is automatically locked for 5min (or maybe just turned black?)
- Now I'm helped to take a break because I cannot do anything in front of the computer other than looking at a black or locked screen :)
- After 5min, the screen automatically returns and I can continue work
Is there a program that does exactly this?
software-recommendation lock-screen
I'm looking for a graphical or command line program that provides me with the following workflow:
- Start a 25min session
- After 25min screen is automatically locked for 5min (or maybe just turned black?)
- Now I'm helped to take a break because I cannot do anything in front of the computer other than looking at a black or locked screen :)
- After 5min, the screen automatically returns and I can continue work
Is there a program that does exactly this?
software-recommendation lock-screen
software-recommendation lock-screen
asked Nov 11 '15 at 9:32
orschiro
5,00764197
5,00764197
As a default feature you mean?
– orschiro
Nov 12 '15 at 7:52
Hi orschiro, it' s done! See latest edit...
– Jacob Vlijm
Dec 3 '15 at 13:01
@JacobVlijm just installed the PPA version. What a beautiful application you created. Thanks again so much!
– orschiro
Dec 5 '15 at 9:34
@orschiro Thank you for the nice question! It was really great fun to work on, and please if you find bugs or if you have suggestions, don't hesitate to mention it on launchpad (either the bug-link or the question-link).
– Jacob Vlijm
Dec 5 '15 at 10:15
add a comment |
As a default feature you mean?
– orschiro
Nov 12 '15 at 7:52
Hi orschiro, it' s done! See latest edit...
– Jacob Vlijm
Dec 3 '15 at 13:01
@JacobVlijm just installed the PPA version. What a beautiful application you created. Thanks again so much!
– orschiro
Dec 5 '15 at 9:34
@orschiro Thank you for the nice question! It was really great fun to work on, and please if you find bugs or if you have suggestions, don't hesitate to mention it on launchpad (either the bug-link or the question-link).
– Jacob Vlijm
Dec 5 '15 at 10:15
As a default feature you mean?
– orschiro
Nov 12 '15 at 7:52
As a default feature you mean?
– orschiro
Nov 12 '15 at 7:52
Hi orschiro, it' s done! See latest edit...
– Jacob Vlijm
Dec 3 '15 at 13:01
Hi orschiro, it' s done! See latest edit...
– Jacob Vlijm
Dec 3 '15 at 13:01
@JacobVlijm just installed the PPA version. What a beautiful application you created. Thanks again so much!
– orschiro
Dec 5 '15 at 9:34
@JacobVlijm just installed the PPA version. What a beautiful application you created. Thanks again so much!
– orschiro
Dec 5 '15 at 9:34
@orschiro Thank you for the nice question! It was really great fun to work on, and please if you find bugs or if you have suggestions, don't hesitate to mention it on launchpad (either the bug-link or the question-link).
– Jacob Vlijm
Dec 5 '15 at 10:15
@orschiro Thank you for the nice question! It was really great fun to work on, and please if you find bugs or if you have suggestions, don't hesitate to mention it on launchpad (either the bug-link or the question-link).
– Jacob Vlijm
Dec 5 '15 at 10:15
add a comment |
6 Answers
6
active
oldest
votes
TakeaBreak
TakeaBreak is now on launchpad
sudo add-apt-repository ppa:vlijm/takeabreak
sudo apt-get update
sudo apt-get install takeabreak
Recently (also) pushed for 18.04 / 18.10 / 19.04
Disclaimer: I am the author
Feel free to file bugs etc. here, or comment here.
Thanks to orschiro for the nice question, and Rinzwind for the encouragement!
remaining break- seconds (using countdown- option)
Settings
Comments are not for extended discussion; this conversation has been moved to chat.
– Thomas Ward♦
Dec 15 at 18:15
add a comment |
You may also want to consider Workrave, although it is no longer under development. I found it easy to use and highly customizable. It also has some preatty nice stats about how you use the computer and how many breaks you take. Lastly, I believe it can also sync itself between many computers, which is useful if, for example, you work both on the laptop and on a school computer.
EDIT: It has many other features that I haven't mentioned, like suggesting some exercises for you to do while the screen is blocked. And it can take into account only the time you're using the computer, so it won't prompt you with a break when you come back from the toilet :)
EDIT 2:
Make sure you check out the "Reading" mode!
The above feature of only counting the time you've been actively using the computer can be seen as a bug if you're not doing much (no mouse, no keyboard events) because it will only prompt your break when you cumulate 1h of usage (or how much time you've set up). In these situations, enabling the "Reading" mode will make it prompt at the exact time, regardless of usage.
Thanks! Among the features, it can thus black or lock my screen during break time?
– orschiro
Nov 11 '15 at 14:45
2
it can definitely block it. not sure about blacking it.
– Ciprian Tomoiagă
Nov 11 '15 at 20:07
It's a nightmare to install.
– bartekbrak
Jul 24 '16 at 11:36
1
@bartekbraksudo apt-get install workrave
?
– Ciprian Tomoiagă
Mar 23 '17 at 23:07
add a comment |
Crude, minimalist, command-line way:
sleep 1500; gnome-screensaver-command -l; sleep 300; killall gnome-screensaver
That can also be turned into a desktop shortcut or turned into function in .bashrc
Why 1500 and 300? because that's seconds, 1500 seconds /60 seconds per minute = 25 minutes.
Below is a script for a timer that allows setting variable session and break time, as well as methods of signalling the break.
Remember that any script on linux must be saved as a file and have executable permissions set with chmod +x /path/to/script.sh
. Once that is done, you can bind the script to a shortcut as show in How do I bind .sh files to keyboard combination? or create a desktop shortcut as shown in How can I create launchers on my desktop?
When you launch the script you should see a menu like this:
#!/bin/bash
# Author: Serg Kolo
# Date : Nov 17th, 2015
# Purpose: pomodoro timer script,
# with bunch of options
# Written for: https://askubuntu.com/q/696620/295286
#####################################################
# screenSaver function
# this one uses gnome-screensaver-command for locking
# and killall for unlocking the screen;
# $1 is provided from chooseBreakMethod function
#####################################################
function screenSaver
{
gnome-screensaver-command -l; sleep $1 ; killall gnome-screensaver
}
##############################################
# dialogBreak function
# this serves as "screensaver". The screen is never
# actually locked but rather we open terminal window
# with a simple command line dialog
# in full sccrean mode
# $1 provided in chooseBreakMethod function
##################################################
function dialogBreak
{
gnome-terminal --full-screen -e "bash -c 'sleep $1 | dialog --progressbox "TAKE A BREAK" 100 100 ' "
}
#################################################################
# dimScreen function
# dims the screen using xrandr; the --brightness
# can be configured
# for full or partial dimming using decimal values
# from 1 to 0
# $1 is provided from chooseBreakMethod function
################################################################
function dimScreen
{
xrandr | awk '$2 == "connected" {print $1}' | xargs -I % xrandr --output % --brightness 0.5
notify-send 'Take a Break'
sleep $1
xrandr | awk '$2 == "connected" {print $1}' | xargs -I % xrandr --output % --brightness 1
}
##############################
# getSettings function
# This is where the user enters
# the settings they want
# All the values must be integers
#############################
function getSettings
{
FORM=$(zenity --forms --title="Sergiy's Tomato Script" --text="Choose this session options"
--add-entry="Number of Sessions (how many loops)"
--add-entry="Session time (minutes)"
--add-entry="Break time (minutes)"
--add-entry="Dim,dialog,or screensaver? (1,2,3)"
--separator=" " )
[ $? -eq 0 ] || exit 1
echo $FORM
}
################################
# chooseBreakMethod function
# A helper function that calls appropriate
# break method, based on the value we got
# from getSettings function
# Because dialogBreak calls gnome-terminal
# this function exits, so it doesn't wait
# Therefore we need to add additional sleep
# command
###############################
function chooseBreakMethod
{
# $1 is method passed from ${SETS[3]}
# $2 is break time passed from ${SETS[2]}
case $1 in
1) dimScreen $2 ;;
2) dialogBreak $2 ; sleep $2 ;;
3) screenSaver $2 ;;
esac
}
function minutesToSeconds
{
echo $(($1*60))
}
#################
# MAIN
#################
# get user settings and store them into array
# Item 0 : num sessions
# Item 1 : session duration
# Item 2 : break duration
# Item 3 : break method - lockscreen, dialog, or just
# turn off the screen
# SETS == settings
SETS=( $(getSettings) )
COUNTER=${SETS[0]}
#######################################
# This is where most of the job is done
# we loop according to number of session
# specified in the getSettings function
#########################################
notify-send 'Session started'
while [ $COUNTER -ne 0 ]; do
sleep $( minutesToSeconds ${SETS[1]} ) # session timer
chooseBreakMethod ${SETS[3]} $( minutesToSeconds ${SETS[2]} )
COUNTER=$(($COUNTER-1))
done
notify-send "tomatoScript is done"
####### END OF SCRIT ###########
I enjoy seeing the different ways that people go about these things. The adage about there being more than one way to skin a cat seems appropriate. Maybe fluff out how to bind it or how to make a desktop shortcut perhaps? (Assuming that completeness is your goal.)
– KGIII
Nov 17 '15 at 22:26
add a comment |
Here is another tool called Safe Eyes for the same purpose.
sudo add-apt-repository ppa:slgobinath/safeeyes
sudo apt-get update
sudo apt-get install safeeyes
Features:
- Short breaks with eye exercises
- Long breaks to change physical position and to warm up
- Strict break for those who are addicted to computer
- Do not disturb when working with fullscreen applications( Eg: Watching movies)
- Disable the keyboard during break
- Notifications before every break
- Support multiple displays
- Pause automatically if the system is idle
- Optional audible alert at the end of breaks
- Multi-language support
For more details: https://github.com/slgobinath/SafeEyes
Love it so much!
– Asalle
May 16 '17 at 10:34
add a comment |
I have used xwrits for many years for this purpose.
sudo apt-get install xwrits
It defaults to a 5 minute break every 55 minutes, but according to the man page these times are customizable via the breaktime
and typetime
commandline options, respectively. You can also control whether it locks the screen using the +lock
option. So to set it for a 5 minute break every 25 minutes locking you out, you should run it like this
xwrits typetime=25 breaktime=5 +lock &
add a comment |
drwright was the typing break component that used to be part of gnome:
http://zeroset.mnim.org/2012/05/11/drwright-a-typing-break-application-for-gnome-and-unity-on-ubuntu-12-04/
and there is a ppa available (although i have not personally used post-12.04): https://launchpad.net/~drwright/+archive/ubuntu/stable
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f696620%2fa-timer-that-automatically-locks-the-screen-to-take-a-break-away-from-the-comput%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
6 Answers
6
active
oldest
votes
6 Answers
6
active
oldest
votes
active
oldest
votes
active
oldest
votes
TakeaBreak
TakeaBreak is now on launchpad
sudo add-apt-repository ppa:vlijm/takeabreak
sudo apt-get update
sudo apt-get install takeabreak
Recently (also) pushed for 18.04 / 18.10 / 19.04
Disclaimer: I am the author
Feel free to file bugs etc. here, or comment here.
Thanks to orschiro for the nice question, and Rinzwind for the encouragement!
remaining break- seconds (using countdown- option)
Settings
Comments are not for extended discussion; this conversation has been moved to chat.
– Thomas Ward♦
Dec 15 at 18:15
add a comment |
TakeaBreak
TakeaBreak is now on launchpad
sudo add-apt-repository ppa:vlijm/takeabreak
sudo apt-get update
sudo apt-get install takeabreak
Recently (also) pushed for 18.04 / 18.10 / 19.04
Disclaimer: I am the author
Feel free to file bugs etc. here, or comment here.
Thanks to orschiro for the nice question, and Rinzwind for the encouragement!
remaining break- seconds (using countdown- option)
Settings
Comments are not for extended discussion; this conversation has been moved to chat.
– Thomas Ward♦
Dec 15 at 18:15
add a comment |
TakeaBreak
TakeaBreak is now on launchpad
sudo add-apt-repository ppa:vlijm/takeabreak
sudo apt-get update
sudo apt-get install takeabreak
Recently (also) pushed for 18.04 / 18.10 / 19.04
Disclaimer: I am the author
Feel free to file bugs etc. here, or comment here.
Thanks to orschiro for the nice question, and Rinzwind for the encouragement!
remaining break- seconds (using countdown- option)
Settings
TakeaBreak
TakeaBreak is now on launchpad
sudo add-apt-repository ppa:vlijm/takeabreak
sudo apt-get update
sudo apt-get install takeabreak
Recently (also) pushed for 18.04 / 18.10 / 19.04
Disclaimer: I am the author
Feel free to file bugs etc. here, or comment here.
Thanks to orschiro for the nice question, and Rinzwind for the encouragement!
remaining break- seconds (using countdown- option)
Settings
edited Dec 15 at 6:21
answered Nov 11 '15 at 10:24
Jacob Vlijm
63.4k9122217
63.4k9122217
Comments are not for extended discussion; this conversation has been moved to chat.
– Thomas Ward♦
Dec 15 at 18:15
add a comment |
Comments are not for extended discussion; this conversation has been moved to chat.
– Thomas Ward♦
Dec 15 at 18:15
Comments are not for extended discussion; this conversation has been moved to chat.
– Thomas Ward♦
Dec 15 at 18:15
Comments are not for extended discussion; this conversation has been moved to chat.
– Thomas Ward♦
Dec 15 at 18:15
add a comment |
You may also want to consider Workrave, although it is no longer under development. I found it easy to use and highly customizable. It also has some preatty nice stats about how you use the computer and how many breaks you take. Lastly, I believe it can also sync itself between many computers, which is useful if, for example, you work both on the laptop and on a school computer.
EDIT: It has many other features that I haven't mentioned, like suggesting some exercises for you to do while the screen is blocked. And it can take into account only the time you're using the computer, so it won't prompt you with a break when you come back from the toilet :)
EDIT 2:
Make sure you check out the "Reading" mode!
The above feature of only counting the time you've been actively using the computer can be seen as a bug if you're not doing much (no mouse, no keyboard events) because it will only prompt your break when you cumulate 1h of usage (or how much time you've set up). In these situations, enabling the "Reading" mode will make it prompt at the exact time, regardless of usage.
Thanks! Among the features, it can thus black or lock my screen during break time?
– orschiro
Nov 11 '15 at 14:45
2
it can definitely block it. not sure about blacking it.
– Ciprian Tomoiagă
Nov 11 '15 at 20:07
It's a nightmare to install.
– bartekbrak
Jul 24 '16 at 11:36
1
@bartekbraksudo apt-get install workrave
?
– Ciprian Tomoiagă
Mar 23 '17 at 23:07
add a comment |
You may also want to consider Workrave, although it is no longer under development. I found it easy to use and highly customizable. It also has some preatty nice stats about how you use the computer and how many breaks you take. Lastly, I believe it can also sync itself between many computers, which is useful if, for example, you work both on the laptop and on a school computer.
EDIT: It has many other features that I haven't mentioned, like suggesting some exercises for you to do while the screen is blocked. And it can take into account only the time you're using the computer, so it won't prompt you with a break when you come back from the toilet :)
EDIT 2:
Make sure you check out the "Reading" mode!
The above feature of only counting the time you've been actively using the computer can be seen as a bug if you're not doing much (no mouse, no keyboard events) because it will only prompt your break when you cumulate 1h of usage (or how much time you've set up). In these situations, enabling the "Reading" mode will make it prompt at the exact time, regardless of usage.
Thanks! Among the features, it can thus black or lock my screen during break time?
– orschiro
Nov 11 '15 at 14:45
2
it can definitely block it. not sure about blacking it.
– Ciprian Tomoiagă
Nov 11 '15 at 20:07
It's a nightmare to install.
– bartekbrak
Jul 24 '16 at 11:36
1
@bartekbraksudo apt-get install workrave
?
– Ciprian Tomoiagă
Mar 23 '17 at 23:07
add a comment |
You may also want to consider Workrave, although it is no longer under development. I found it easy to use and highly customizable. It also has some preatty nice stats about how you use the computer and how many breaks you take. Lastly, I believe it can also sync itself between many computers, which is useful if, for example, you work both on the laptop and on a school computer.
EDIT: It has many other features that I haven't mentioned, like suggesting some exercises for you to do while the screen is blocked. And it can take into account only the time you're using the computer, so it won't prompt you with a break when you come back from the toilet :)
EDIT 2:
Make sure you check out the "Reading" mode!
The above feature of only counting the time you've been actively using the computer can be seen as a bug if you're not doing much (no mouse, no keyboard events) because it will only prompt your break when you cumulate 1h of usage (or how much time you've set up). In these situations, enabling the "Reading" mode will make it prompt at the exact time, regardless of usage.
You may also want to consider Workrave, although it is no longer under development. I found it easy to use and highly customizable. It also has some preatty nice stats about how you use the computer and how many breaks you take. Lastly, I believe it can also sync itself between many computers, which is useful if, for example, you work both on the laptop and on a school computer.
EDIT: It has many other features that I haven't mentioned, like suggesting some exercises for you to do while the screen is blocked. And it can take into account only the time you're using the computer, so it won't prompt you with a break when you come back from the toilet :)
EDIT 2:
Make sure you check out the "Reading" mode!
The above feature of only counting the time you've been actively using the computer can be seen as a bug if you're not doing much (no mouse, no keyboard events) because it will only prompt your break when you cumulate 1h of usage (or how much time you've set up). In these situations, enabling the "Reading" mode will make it prompt at the exact time, regardless of usage.
edited Mar 23 '17 at 23:12
answered Nov 11 '15 at 12:17
Ciprian Tomoiagă
47129
47129
Thanks! Among the features, it can thus black or lock my screen during break time?
– orschiro
Nov 11 '15 at 14:45
2
it can definitely block it. not sure about blacking it.
– Ciprian Tomoiagă
Nov 11 '15 at 20:07
It's a nightmare to install.
– bartekbrak
Jul 24 '16 at 11:36
1
@bartekbraksudo apt-get install workrave
?
– Ciprian Tomoiagă
Mar 23 '17 at 23:07
add a comment |
Thanks! Among the features, it can thus black or lock my screen during break time?
– orschiro
Nov 11 '15 at 14:45
2
it can definitely block it. not sure about blacking it.
– Ciprian Tomoiagă
Nov 11 '15 at 20:07
It's a nightmare to install.
– bartekbrak
Jul 24 '16 at 11:36
1
@bartekbraksudo apt-get install workrave
?
– Ciprian Tomoiagă
Mar 23 '17 at 23:07
Thanks! Among the features, it can thus black or lock my screen during break time?
– orschiro
Nov 11 '15 at 14:45
Thanks! Among the features, it can thus black or lock my screen during break time?
– orschiro
Nov 11 '15 at 14:45
2
2
it can definitely block it. not sure about blacking it.
– Ciprian Tomoiagă
Nov 11 '15 at 20:07
it can definitely block it. not sure about blacking it.
– Ciprian Tomoiagă
Nov 11 '15 at 20:07
It's a nightmare to install.
– bartekbrak
Jul 24 '16 at 11:36
It's a nightmare to install.
– bartekbrak
Jul 24 '16 at 11:36
1
1
@bartekbrak
sudo apt-get install workrave
?– Ciprian Tomoiagă
Mar 23 '17 at 23:07
@bartekbrak
sudo apt-get install workrave
?– Ciprian Tomoiagă
Mar 23 '17 at 23:07
add a comment |
Crude, minimalist, command-line way:
sleep 1500; gnome-screensaver-command -l; sleep 300; killall gnome-screensaver
That can also be turned into a desktop shortcut or turned into function in .bashrc
Why 1500 and 300? because that's seconds, 1500 seconds /60 seconds per minute = 25 minutes.
Below is a script for a timer that allows setting variable session and break time, as well as methods of signalling the break.
Remember that any script on linux must be saved as a file and have executable permissions set with chmod +x /path/to/script.sh
. Once that is done, you can bind the script to a shortcut as show in How do I bind .sh files to keyboard combination? or create a desktop shortcut as shown in How can I create launchers on my desktop?
When you launch the script you should see a menu like this:
#!/bin/bash
# Author: Serg Kolo
# Date : Nov 17th, 2015
# Purpose: pomodoro timer script,
# with bunch of options
# Written for: https://askubuntu.com/q/696620/295286
#####################################################
# screenSaver function
# this one uses gnome-screensaver-command for locking
# and killall for unlocking the screen;
# $1 is provided from chooseBreakMethod function
#####################################################
function screenSaver
{
gnome-screensaver-command -l; sleep $1 ; killall gnome-screensaver
}
##############################################
# dialogBreak function
# this serves as "screensaver". The screen is never
# actually locked but rather we open terminal window
# with a simple command line dialog
# in full sccrean mode
# $1 provided in chooseBreakMethod function
##################################################
function dialogBreak
{
gnome-terminal --full-screen -e "bash -c 'sleep $1 | dialog --progressbox "TAKE A BREAK" 100 100 ' "
}
#################################################################
# dimScreen function
# dims the screen using xrandr; the --brightness
# can be configured
# for full or partial dimming using decimal values
# from 1 to 0
# $1 is provided from chooseBreakMethod function
################################################################
function dimScreen
{
xrandr | awk '$2 == "connected" {print $1}' | xargs -I % xrandr --output % --brightness 0.5
notify-send 'Take a Break'
sleep $1
xrandr | awk '$2 == "connected" {print $1}' | xargs -I % xrandr --output % --brightness 1
}
##############################
# getSettings function
# This is where the user enters
# the settings they want
# All the values must be integers
#############################
function getSettings
{
FORM=$(zenity --forms --title="Sergiy's Tomato Script" --text="Choose this session options"
--add-entry="Number of Sessions (how many loops)"
--add-entry="Session time (minutes)"
--add-entry="Break time (minutes)"
--add-entry="Dim,dialog,or screensaver? (1,2,3)"
--separator=" " )
[ $? -eq 0 ] || exit 1
echo $FORM
}
################################
# chooseBreakMethod function
# A helper function that calls appropriate
# break method, based on the value we got
# from getSettings function
# Because dialogBreak calls gnome-terminal
# this function exits, so it doesn't wait
# Therefore we need to add additional sleep
# command
###############################
function chooseBreakMethod
{
# $1 is method passed from ${SETS[3]}
# $2 is break time passed from ${SETS[2]}
case $1 in
1) dimScreen $2 ;;
2) dialogBreak $2 ; sleep $2 ;;
3) screenSaver $2 ;;
esac
}
function minutesToSeconds
{
echo $(($1*60))
}
#################
# MAIN
#################
# get user settings and store them into array
# Item 0 : num sessions
# Item 1 : session duration
# Item 2 : break duration
# Item 3 : break method - lockscreen, dialog, or just
# turn off the screen
# SETS == settings
SETS=( $(getSettings) )
COUNTER=${SETS[0]}
#######################################
# This is where most of the job is done
# we loop according to number of session
# specified in the getSettings function
#########################################
notify-send 'Session started'
while [ $COUNTER -ne 0 ]; do
sleep $( minutesToSeconds ${SETS[1]} ) # session timer
chooseBreakMethod ${SETS[3]} $( minutesToSeconds ${SETS[2]} )
COUNTER=$(($COUNTER-1))
done
notify-send "tomatoScript is done"
####### END OF SCRIT ###########
I enjoy seeing the different ways that people go about these things. The adage about there being more than one way to skin a cat seems appropriate. Maybe fluff out how to bind it or how to make a desktop shortcut perhaps? (Assuming that completeness is your goal.)
– KGIII
Nov 17 '15 at 22:26
add a comment |
Crude, minimalist, command-line way:
sleep 1500; gnome-screensaver-command -l; sleep 300; killall gnome-screensaver
That can also be turned into a desktop shortcut or turned into function in .bashrc
Why 1500 and 300? because that's seconds, 1500 seconds /60 seconds per minute = 25 minutes.
Below is a script for a timer that allows setting variable session and break time, as well as methods of signalling the break.
Remember that any script on linux must be saved as a file and have executable permissions set with chmod +x /path/to/script.sh
. Once that is done, you can bind the script to a shortcut as show in How do I bind .sh files to keyboard combination? or create a desktop shortcut as shown in How can I create launchers on my desktop?
When you launch the script you should see a menu like this:
#!/bin/bash
# Author: Serg Kolo
# Date : Nov 17th, 2015
# Purpose: pomodoro timer script,
# with bunch of options
# Written for: https://askubuntu.com/q/696620/295286
#####################################################
# screenSaver function
# this one uses gnome-screensaver-command for locking
# and killall for unlocking the screen;
# $1 is provided from chooseBreakMethod function
#####################################################
function screenSaver
{
gnome-screensaver-command -l; sleep $1 ; killall gnome-screensaver
}
##############################################
# dialogBreak function
# this serves as "screensaver". The screen is never
# actually locked but rather we open terminal window
# with a simple command line dialog
# in full sccrean mode
# $1 provided in chooseBreakMethod function
##################################################
function dialogBreak
{
gnome-terminal --full-screen -e "bash -c 'sleep $1 | dialog --progressbox "TAKE A BREAK" 100 100 ' "
}
#################################################################
# dimScreen function
# dims the screen using xrandr; the --brightness
# can be configured
# for full or partial dimming using decimal values
# from 1 to 0
# $1 is provided from chooseBreakMethod function
################################################################
function dimScreen
{
xrandr | awk '$2 == "connected" {print $1}' | xargs -I % xrandr --output % --brightness 0.5
notify-send 'Take a Break'
sleep $1
xrandr | awk '$2 == "connected" {print $1}' | xargs -I % xrandr --output % --brightness 1
}
##############################
# getSettings function
# This is where the user enters
# the settings they want
# All the values must be integers
#############################
function getSettings
{
FORM=$(zenity --forms --title="Sergiy's Tomato Script" --text="Choose this session options"
--add-entry="Number of Sessions (how many loops)"
--add-entry="Session time (minutes)"
--add-entry="Break time (minutes)"
--add-entry="Dim,dialog,or screensaver? (1,2,3)"
--separator=" " )
[ $? -eq 0 ] || exit 1
echo $FORM
}
################################
# chooseBreakMethod function
# A helper function that calls appropriate
# break method, based on the value we got
# from getSettings function
# Because dialogBreak calls gnome-terminal
# this function exits, so it doesn't wait
# Therefore we need to add additional sleep
# command
###############################
function chooseBreakMethod
{
# $1 is method passed from ${SETS[3]}
# $2 is break time passed from ${SETS[2]}
case $1 in
1) dimScreen $2 ;;
2) dialogBreak $2 ; sleep $2 ;;
3) screenSaver $2 ;;
esac
}
function minutesToSeconds
{
echo $(($1*60))
}
#################
# MAIN
#################
# get user settings and store them into array
# Item 0 : num sessions
# Item 1 : session duration
# Item 2 : break duration
# Item 3 : break method - lockscreen, dialog, or just
# turn off the screen
# SETS == settings
SETS=( $(getSettings) )
COUNTER=${SETS[0]}
#######################################
# This is where most of the job is done
# we loop according to number of session
# specified in the getSettings function
#########################################
notify-send 'Session started'
while [ $COUNTER -ne 0 ]; do
sleep $( minutesToSeconds ${SETS[1]} ) # session timer
chooseBreakMethod ${SETS[3]} $( minutesToSeconds ${SETS[2]} )
COUNTER=$(($COUNTER-1))
done
notify-send "tomatoScript is done"
####### END OF SCRIT ###########
I enjoy seeing the different ways that people go about these things. The adage about there being more than one way to skin a cat seems appropriate. Maybe fluff out how to bind it or how to make a desktop shortcut perhaps? (Assuming that completeness is your goal.)
– KGIII
Nov 17 '15 at 22:26
add a comment |
Crude, minimalist, command-line way:
sleep 1500; gnome-screensaver-command -l; sleep 300; killall gnome-screensaver
That can also be turned into a desktop shortcut or turned into function in .bashrc
Why 1500 and 300? because that's seconds, 1500 seconds /60 seconds per minute = 25 minutes.
Below is a script for a timer that allows setting variable session and break time, as well as methods of signalling the break.
Remember that any script on linux must be saved as a file and have executable permissions set with chmod +x /path/to/script.sh
. Once that is done, you can bind the script to a shortcut as show in How do I bind .sh files to keyboard combination? or create a desktop shortcut as shown in How can I create launchers on my desktop?
When you launch the script you should see a menu like this:
#!/bin/bash
# Author: Serg Kolo
# Date : Nov 17th, 2015
# Purpose: pomodoro timer script,
# with bunch of options
# Written for: https://askubuntu.com/q/696620/295286
#####################################################
# screenSaver function
# this one uses gnome-screensaver-command for locking
# and killall for unlocking the screen;
# $1 is provided from chooseBreakMethod function
#####################################################
function screenSaver
{
gnome-screensaver-command -l; sleep $1 ; killall gnome-screensaver
}
##############################################
# dialogBreak function
# this serves as "screensaver". The screen is never
# actually locked but rather we open terminal window
# with a simple command line dialog
# in full sccrean mode
# $1 provided in chooseBreakMethod function
##################################################
function dialogBreak
{
gnome-terminal --full-screen -e "bash -c 'sleep $1 | dialog --progressbox "TAKE A BREAK" 100 100 ' "
}
#################################################################
# dimScreen function
# dims the screen using xrandr; the --brightness
# can be configured
# for full or partial dimming using decimal values
# from 1 to 0
# $1 is provided from chooseBreakMethod function
################################################################
function dimScreen
{
xrandr | awk '$2 == "connected" {print $1}' | xargs -I % xrandr --output % --brightness 0.5
notify-send 'Take a Break'
sleep $1
xrandr | awk '$2 == "connected" {print $1}' | xargs -I % xrandr --output % --brightness 1
}
##############################
# getSettings function
# This is where the user enters
# the settings they want
# All the values must be integers
#############################
function getSettings
{
FORM=$(zenity --forms --title="Sergiy's Tomato Script" --text="Choose this session options"
--add-entry="Number of Sessions (how many loops)"
--add-entry="Session time (minutes)"
--add-entry="Break time (minutes)"
--add-entry="Dim,dialog,or screensaver? (1,2,3)"
--separator=" " )
[ $? -eq 0 ] || exit 1
echo $FORM
}
################################
# chooseBreakMethod function
# A helper function that calls appropriate
# break method, based on the value we got
# from getSettings function
# Because dialogBreak calls gnome-terminal
# this function exits, so it doesn't wait
# Therefore we need to add additional sleep
# command
###############################
function chooseBreakMethod
{
# $1 is method passed from ${SETS[3]}
# $2 is break time passed from ${SETS[2]}
case $1 in
1) dimScreen $2 ;;
2) dialogBreak $2 ; sleep $2 ;;
3) screenSaver $2 ;;
esac
}
function minutesToSeconds
{
echo $(($1*60))
}
#################
# MAIN
#################
# get user settings and store them into array
# Item 0 : num sessions
# Item 1 : session duration
# Item 2 : break duration
# Item 3 : break method - lockscreen, dialog, or just
# turn off the screen
# SETS == settings
SETS=( $(getSettings) )
COUNTER=${SETS[0]}
#######################################
# This is where most of the job is done
# we loop according to number of session
# specified in the getSettings function
#########################################
notify-send 'Session started'
while [ $COUNTER -ne 0 ]; do
sleep $( minutesToSeconds ${SETS[1]} ) # session timer
chooseBreakMethod ${SETS[3]} $( minutesToSeconds ${SETS[2]} )
COUNTER=$(($COUNTER-1))
done
notify-send "tomatoScript is done"
####### END OF SCRIT ###########
Crude, minimalist, command-line way:
sleep 1500; gnome-screensaver-command -l; sleep 300; killall gnome-screensaver
That can also be turned into a desktop shortcut or turned into function in .bashrc
Why 1500 and 300? because that's seconds, 1500 seconds /60 seconds per minute = 25 minutes.
Below is a script for a timer that allows setting variable session and break time, as well as methods of signalling the break.
Remember that any script on linux must be saved as a file and have executable permissions set with chmod +x /path/to/script.sh
. Once that is done, you can bind the script to a shortcut as show in How do I bind .sh files to keyboard combination? or create a desktop shortcut as shown in How can I create launchers on my desktop?
When you launch the script you should see a menu like this:
#!/bin/bash
# Author: Serg Kolo
# Date : Nov 17th, 2015
# Purpose: pomodoro timer script,
# with bunch of options
# Written for: https://askubuntu.com/q/696620/295286
#####################################################
# screenSaver function
# this one uses gnome-screensaver-command for locking
# and killall for unlocking the screen;
# $1 is provided from chooseBreakMethod function
#####################################################
function screenSaver
{
gnome-screensaver-command -l; sleep $1 ; killall gnome-screensaver
}
##############################################
# dialogBreak function
# this serves as "screensaver". The screen is never
# actually locked but rather we open terminal window
# with a simple command line dialog
# in full sccrean mode
# $1 provided in chooseBreakMethod function
##################################################
function dialogBreak
{
gnome-terminal --full-screen -e "bash -c 'sleep $1 | dialog --progressbox "TAKE A BREAK" 100 100 ' "
}
#################################################################
# dimScreen function
# dims the screen using xrandr; the --brightness
# can be configured
# for full or partial dimming using decimal values
# from 1 to 0
# $1 is provided from chooseBreakMethod function
################################################################
function dimScreen
{
xrandr | awk '$2 == "connected" {print $1}' | xargs -I % xrandr --output % --brightness 0.5
notify-send 'Take a Break'
sleep $1
xrandr | awk '$2 == "connected" {print $1}' | xargs -I % xrandr --output % --brightness 1
}
##############################
# getSettings function
# This is where the user enters
# the settings they want
# All the values must be integers
#############################
function getSettings
{
FORM=$(zenity --forms --title="Sergiy's Tomato Script" --text="Choose this session options"
--add-entry="Number of Sessions (how many loops)"
--add-entry="Session time (minutes)"
--add-entry="Break time (minutes)"
--add-entry="Dim,dialog,or screensaver? (1,2,3)"
--separator=" " )
[ $? -eq 0 ] || exit 1
echo $FORM
}
################################
# chooseBreakMethod function
# A helper function that calls appropriate
# break method, based on the value we got
# from getSettings function
# Because dialogBreak calls gnome-terminal
# this function exits, so it doesn't wait
# Therefore we need to add additional sleep
# command
###############################
function chooseBreakMethod
{
# $1 is method passed from ${SETS[3]}
# $2 is break time passed from ${SETS[2]}
case $1 in
1) dimScreen $2 ;;
2) dialogBreak $2 ; sleep $2 ;;
3) screenSaver $2 ;;
esac
}
function minutesToSeconds
{
echo $(($1*60))
}
#################
# MAIN
#################
# get user settings and store them into array
# Item 0 : num sessions
# Item 1 : session duration
# Item 2 : break duration
# Item 3 : break method - lockscreen, dialog, or just
# turn off the screen
# SETS == settings
SETS=( $(getSettings) )
COUNTER=${SETS[0]}
#######################################
# This is where most of the job is done
# we loop according to number of session
# specified in the getSettings function
#########################################
notify-send 'Session started'
while [ $COUNTER -ne 0 ]; do
sleep $( minutesToSeconds ${SETS[1]} ) # session timer
chooseBreakMethod ${SETS[3]} $( minutesToSeconds ${SETS[2]} )
COUNTER=$(($COUNTER-1))
done
notify-send "tomatoScript is done"
####### END OF SCRIT ###########
edited Apr 13 '17 at 12:24
Community♦
1
1
answered Nov 16 '15 at 10:16
Sergiy Kolodyazhnyy
69.3k9144304
69.3k9144304
I enjoy seeing the different ways that people go about these things. The adage about there being more than one way to skin a cat seems appropriate. Maybe fluff out how to bind it or how to make a desktop shortcut perhaps? (Assuming that completeness is your goal.)
– KGIII
Nov 17 '15 at 22:26
add a comment |
I enjoy seeing the different ways that people go about these things. The adage about there being more than one way to skin a cat seems appropriate. Maybe fluff out how to bind it or how to make a desktop shortcut perhaps? (Assuming that completeness is your goal.)
– KGIII
Nov 17 '15 at 22:26
I enjoy seeing the different ways that people go about these things. The adage about there being more than one way to skin a cat seems appropriate. Maybe fluff out how to bind it or how to make a desktop shortcut perhaps? (Assuming that completeness is your goal.)
– KGIII
Nov 17 '15 at 22:26
I enjoy seeing the different ways that people go about these things. The adage about there being more than one way to skin a cat seems appropriate. Maybe fluff out how to bind it or how to make a desktop shortcut perhaps? (Assuming that completeness is your goal.)
– KGIII
Nov 17 '15 at 22:26
add a comment |
Here is another tool called Safe Eyes for the same purpose.
sudo add-apt-repository ppa:slgobinath/safeeyes
sudo apt-get update
sudo apt-get install safeeyes
Features:
- Short breaks with eye exercises
- Long breaks to change physical position and to warm up
- Strict break for those who are addicted to computer
- Do not disturb when working with fullscreen applications( Eg: Watching movies)
- Disable the keyboard during break
- Notifications before every break
- Support multiple displays
- Pause automatically if the system is idle
- Optional audible alert at the end of breaks
- Multi-language support
For more details: https://github.com/slgobinath/SafeEyes
Love it so much!
– Asalle
May 16 '17 at 10:34
add a comment |
Here is another tool called Safe Eyes for the same purpose.
sudo add-apt-repository ppa:slgobinath/safeeyes
sudo apt-get update
sudo apt-get install safeeyes
Features:
- Short breaks with eye exercises
- Long breaks to change physical position and to warm up
- Strict break for those who are addicted to computer
- Do not disturb when working with fullscreen applications( Eg: Watching movies)
- Disable the keyboard during break
- Notifications before every break
- Support multiple displays
- Pause automatically if the system is idle
- Optional audible alert at the end of breaks
- Multi-language support
For more details: https://github.com/slgobinath/SafeEyes
Love it so much!
– Asalle
May 16 '17 at 10:34
add a comment |
Here is another tool called Safe Eyes for the same purpose.
sudo add-apt-repository ppa:slgobinath/safeeyes
sudo apt-get update
sudo apt-get install safeeyes
Features:
- Short breaks with eye exercises
- Long breaks to change physical position and to warm up
- Strict break for those who are addicted to computer
- Do not disturb when working with fullscreen applications( Eg: Watching movies)
- Disable the keyboard during break
- Notifications before every break
- Support multiple displays
- Pause automatically if the system is idle
- Optional audible alert at the end of breaks
- Multi-language support
For more details: https://github.com/slgobinath/SafeEyes
Here is another tool called Safe Eyes for the same purpose.
sudo add-apt-repository ppa:slgobinath/safeeyes
sudo apt-get update
sudo apt-get install safeeyes
Features:
- Short breaks with eye exercises
- Long breaks to change physical position and to warm up
- Strict break for those who are addicted to computer
- Do not disturb when working with fullscreen applications( Eg: Watching movies)
- Disable the keyboard during break
- Notifications before every break
- Support multiple displays
- Pause automatically if the system is idle
- Optional audible alert at the end of breaks
- Multi-language support
For more details: https://github.com/slgobinath/SafeEyes
edited Feb 9 '17 at 23:36
answered Oct 23 '16 at 12:52
Gobinath
1,75111326
1,75111326
Love it so much!
– Asalle
May 16 '17 at 10:34
add a comment |
Love it so much!
– Asalle
May 16 '17 at 10:34
Love it so much!
– Asalle
May 16 '17 at 10:34
Love it so much!
– Asalle
May 16 '17 at 10:34
add a comment |
I have used xwrits for many years for this purpose.
sudo apt-get install xwrits
It defaults to a 5 minute break every 55 minutes, but according to the man page these times are customizable via the breaktime
and typetime
commandline options, respectively. You can also control whether it locks the screen using the +lock
option. So to set it for a 5 minute break every 25 minutes locking you out, you should run it like this
xwrits typetime=25 breaktime=5 +lock &
add a comment |
I have used xwrits for many years for this purpose.
sudo apt-get install xwrits
It defaults to a 5 minute break every 55 minutes, but according to the man page these times are customizable via the breaktime
and typetime
commandline options, respectively. You can also control whether it locks the screen using the +lock
option. So to set it for a 5 minute break every 25 minutes locking you out, you should run it like this
xwrits typetime=25 breaktime=5 +lock &
add a comment |
I have used xwrits for many years for this purpose.
sudo apt-get install xwrits
It defaults to a 5 minute break every 55 minutes, but according to the man page these times are customizable via the breaktime
and typetime
commandline options, respectively. You can also control whether it locks the screen using the +lock
option. So to set it for a 5 minute break every 25 minutes locking you out, you should run it like this
xwrits typetime=25 breaktime=5 +lock &
I have used xwrits for many years for this purpose.
sudo apt-get install xwrits
It defaults to a 5 minute break every 55 minutes, but according to the man page these times are customizable via the breaktime
and typetime
commandline options, respectively. You can also control whether it locks the screen using the +lock
option. So to set it for a 5 minute break every 25 minutes locking you out, you should run it like this
xwrits typetime=25 breaktime=5 +lock &
answered Nov 16 '15 at 20:48
Michael Mandel
612
612
add a comment |
add a comment |
drwright was the typing break component that used to be part of gnome:
http://zeroset.mnim.org/2012/05/11/drwright-a-typing-break-application-for-gnome-and-unity-on-ubuntu-12-04/
and there is a ppa available (although i have not personally used post-12.04): https://launchpad.net/~drwright/+archive/ubuntu/stable
add a comment |
drwright was the typing break component that used to be part of gnome:
http://zeroset.mnim.org/2012/05/11/drwright-a-typing-break-application-for-gnome-and-unity-on-ubuntu-12-04/
and there is a ppa available (although i have not personally used post-12.04): https://launchpad.net/~drwright/+archive/ubuntu/stable
add a comment |
drwright was the typing break component that used to be part of gnome:
http://zeroset.mnim.org/2012/05/11/drwright-a-typing-break-application-for-gnome-and-unity-on-ubuntu-12-04/
and there is a ppa available (although i have not personally used post-12.04): https://launchpad.net/~drwright/+archive/ubuntu/stable
drwright was the typing break component that used to be part of gnome:
http://zeroset.mnim.org/2012/05/11/drwright-a-typing-break-application-for-gnome-and-unity-on-ubuntu-12-04/
and there is a ppa available (although i have not personally used post-12.04): https://launchpad.net/~drwright/+archive/ubuntu/stable
answered Nov 16 '15 at 22:09
andrew bezella
91
91
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f696620%2fa-timer-that-automatically-locks-the-screen-to-take-a-break-away-from-the-comput%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
As a default feature you mean?
– orschiro
Nov 12 '15 at 7:52
Hi orschiro, it' s done! See latest edit...
– Jacob Vlijm
Dec 3 '15 at 13:01
@JacobVlijm just installed the PPA version. What a beautiful application you created. Thanks again so much!
– orschiro
Dec 5 '15 at 9:34
@orschiro Thank you for the nice question! It was really great fun to work on, and please if you find bugs or if you have suggestions, don't hesitate to mention it on launchpad (either the bug-link or the question-link).
– Jacob Vlijm
Dec 5 '15 at 10:15