You are not logged in.
Pages: 1
I read somewhere that a good way to keep your eyes from hurting staring at a screen is to look away every 20 minutes. What's a cheap way to have my Arch box set off beep or two every 20 minutes? A friend of mine suggested running a shell loop that sleeps for 20 minutes and does something, question is: what? Man pages show a beep system call but I don't want to write a C program if i can get away with a script. Any ideas?
The Bytebaker -- Computer science is not a science and it's not about computers
Check out my open source software at Github
Offline
These might be of interest :
http://eyedeal.team88.org/node/86
and best of all its in [community]
Last edited by Inxsible (2010-07-22 23:45:02)
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
> a shell loop that sleeps for 20 minutes and does something, question is: what?
I have the answer:
[karol@black ~]$ type beep
beep is aliased to `speaker-test -t sine -f 1000 -l 2 2>&1'
Don't play it too loud in the middle of the night.
Offline
If you can manually set the binary to be world-executable (chmod u+x), you could install a package called "beep," which uses the PC speaker (technically a square wave synth). If you want to set it off every 20 minutes, you're best off with cron. For every 20 minutes, the entry in your crontab (insert it via pasting into `crontab -e`) would be as follows:
*/20 * * * * beep -l 500 -r 3
Note that this would do it every 20 minutes regardless of what you are doing at the time; thus, a better alternative would be something like
*/20 * * * * [[ "$BEEPING" == "1" ]] && beep -l 500 -r 3
, where BEEPING is an environmental variable. Environmental variables are set with the `export` command, like so: `export BEEPING=0`. You could also make aliases in your .bashrc to turn the beeping on and off, like so:
alias beep_on="export BEEPING=1"
alias beep_off="export BEEPING=0"
Offline
Note that this would do it every 20 minutes regardless of what you are doing at the time; thus, a better alternative would be something like
*/20 * * * * [[ "$BEEPING" == "1" ]] && beep -l 500 -r 3
, where BEEPING is an environmental variable. Environmental variables are set with the `export` command, like so: `export BEEPING=0`. You could also make aliases in your .bashrc to turn the beeping on and off, like so:
alias beep_on="export BEEPING=1" alias beep_off="export BEEPING=0"
This will NOT work. Setting a variable in your shell will not affect how it's set in a cron session.
Offline
I read somewhere that a good way to keep your eyes from hurting staring at a screen is to look away every 20 minutes. What's a cheap way to have my Arch box set off beep or two every 20 minutes? A friend of mine suggested running a shell loop that sleeps for 20 minutes and does something, question is: what? Man pages show a beep system call but I don't want to write a C program if i can get away with a script. Any ideas?
ASCII has a bell character.
aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies
Offline
> ASCII has a bell character.
Do you know how can I enable it but disable the beep readline (?) makes when I remove "too much" characters?
Offline
See bell-style in http://www.gnu.org/software/bash/manual … yntax.html .
aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies
Offline
See bell-style in http://www.gnu.org/software/bash/manual … yntax.html .
Yeah, I know about that, but it seems I can set it only as all or nothing. The world is so cruel ...
Thanks anyway :-)
Back on topic: maybe ejecting the CD/DVD-ROM tray would be a good indication?
Last edited by karol (2010-07-23 08:48:03)
Offline
If we're going in that direction, ThinkGeek has USB rocket launchers. OP could script them to fire at his head every 20 minutes. The time spent bandaging the wound and re-attaching the rockets should be plenty enough to rest the eyes.
edit: np Karol
Last edited by fsckd (2010-07-23 08:56:12)
aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies
Offline
If we're going in that direction, ThinkGeek has USB rocket launchers. OP could script them to fire at his head every 20 minutes. The time spent bandaging the wound and re-attaching the rockets should be plenty enough to rest the eyes.
edit: np Karol
Basu, do you have a webcam? :-D
There are various tools that will show a message e.g. "You need to take a break (doctor's orders)."
Maybe you can automatically (s)lock your computer every n minutes?
Offline
or maybe
xset dpms force off
This will turn of your monitor until you move your mouse or press a key.
Nice idea, but if the user is constantly doing sth it doesn't make much sense.
Offline
Just download a nice sound sample that you like and use it with mplayer or whatever. I prefer a kitchen timer-like 'ding' sound.
Put in a shellscript something like:
while true; mplayer ding.wav && sleep 20m; done > /dev/null
and you're off.
Offline
Just download a nice sound sample that you like and use it with mplayer or whatever. I prefer a kitchen timer-like 'ding' sound.
Put in a shellscript something like:while true; mplayer ding.wav && sleep 20m; done > /dev/null
and you're off.
Either Rickroll or this ;P
I had the latter as an alarm for quite some time.
Offline
knopwob wrote:or maybe
xset dpms force off
This will turn of your monitor until you move your mouse or press a key.
Nice idea, but if the user is constantly doing sth it doesn't make much sense.
good point. here's another idea if libnotify is installed:
notify-send "There's someone behind you"
edit:
or to get annoyed as hell
shutdown -h now
Last edited by knopwob (2010-07-23 10:14:51)
Offline
@Inxsible: workrave looks good, but there a bunch of Gnome dependencies which are fine when I"m actually in Gnome, but I'd rather not pull up something like that when I'm in Xmonad.
@ataraxia Can you recommend how I could get something that works the same way? Without turning cron on and off?
I think turning off my monitor or shutting down entirely is a bit overkill. But thanks for all the suggestions
The Bytebaker -- Computer science is not a science and it's not about computers
Check out my open source software at Github
Offline
@ataraxia Can you recommend how I could get something that works the same way? Without turning cron on and off?
You could use a file:
*/20 * * * * [[ -f "/tmp/beeping" ]] && beep -l 500 -r 3
alias beep_on="/bin/touch /tmp/beeping"
alias beep_off="/bin/rm -f /tmp/beeping"
Offline
Use yasen's script with karol's speaker-test beep code, and just have it run at startup. Put it in /etc/rc.local to start it at startup.
Intrepid (adj.): Resolutely courageous; fearless.
Offline
Python script:
#!/usr/bin/env python
while True:
time.sleep(1200)
print('\a')
It's heavier but it works well. PC speaker needs to be enabled of course.
Personally, I'd rather be back in Hobbiton.
Offline
Right, Anikom's script is also very good. Use one of these scripts and rc.local, and you won't have to start it up or worry about Cron jobs.
Intrepid (adj.): Resolutely courageous; fearless.
Offline
Pages: 1