6

I use the 'alarm-clock-applet' to notify me every so often to take a break from looking at my screen and give my eyes a bit of a rest. The interface is clunky, but it works.

One issue I'm having, though, is that sometimes I don't notice when it goes off. The indicator icon in the Gnome panel (I use Flashback) turns yellow, but it's easy to miss.

It can be set to play a sound, but I'm often using my laptop in public settings where having an alarm go off at regular intervals wouldn't be acceptable.

The program does offer me the option of running a command when the alarm goes off. It would be great if I could set something that maybe placed notice on my screen that I couldn't ignore, or overlayed a transparent red over everthing, or something like that. I'm open to ideas, the point just being that it should be something that there is no way I can ignore it.

Is there any command I can run that would create some kind of completely blatant visual notification?

Braiam
  • 67,791
  • 32
  • 179
  • 269
Questioner
  • 6,839
  • 1
    This may be an alternative for you: http://askubuntu.com/questions/63999/how-can-i-install-typing-break – Takkat May 12 '14 at 11:23

7 Answers7

5

You can use zenity to creates Graphical (GTK+) Dialog Boxes.

Try to add this command:

zenity --warning --text="Insert yout text here!"

or insert command inside a script.

Refer to zenity --help or man zenity for more help.

girardengo
  • 4,965
  • 1
  • 26
  • 31
4

Make the alarm clock dim and colour your screen, with the option to snooze or dismiss:

enter image description here

  • Create a directory ~/bin
  • Copy the code for the script below, save it as alarm in~/bin.
  • Replace the value in snooze_time = 90 by the time you'd like to have as snooze interval. If you want, you can also play with the gamma- and brightness values, as long as you keep the syntax (the values in the first line after while snoozeoption == 1:).

  • Make the script executable. To save it in ~/bin and make the script executable is necessary, since the clock applet does not run composed commands; you need to be able call the script with a single command from the alarm clock applet.

You may have to log out/in before it works.

This is the script:

#!/usr/bin/python3

import subprocess
import time

# snooze time
snooze_time = 90

def get_screenname():
    screendata = subprocess.Popen(["xrandr"], stdout=subprocess.PIPE)
    return [line for line in screendata.communicate()[0].decode("utf-8").split("\n") if " connected" in line][0].split(" ")[0]

screen = get_screenname()
snoozeoption = 1

while snoozeoption == 1:
    subprocess.Popen(["xrandr", "--output", screen, "--gamma", "1:1:0.3", "--brightness", "0.6"])
    snoozeoption = subprocess.call(["zenity", "--question", "--text=What to do?",  "--ok-label=Dismiss", "--cancel-label=Snooze", "--title=Take a Break"])
    if snoozeoption == 1:
        subprocess.call(["xrandr", "--output", screen, "--gamma", "1:1:1", "--brightness", "1"])
        time.sleep(snooze_time)
    else:
        pass
subprocess.call(["xrandr", "--output", screen, "--gamma", "1:1:1", "--brightness", "1"])
  • In the alarm clock applet, set the command to run:

    alarm
    
Jacob Vlijm
  • 83,767
  • This is cool. However, the limitations I see are that it only cycles once. If I happen to be looking somewhere else, I might miss it. Isthere a way to make it keep cycling until I stop it? Also, for extra super bonus points, if the screen colour could be altered, to red or green shift it, that would be really, really awesome. – Questioner May 12 '14 at 08:03
  • Done! made the script colour your screen +dim, with an option to (endlessly) cycle, unless you tell it to dismiss. – Jacob Vlijm May 12 '14 at 12:15
  • Unfortunately, while I could get the script to work fine from the command line, it would not work from within the alarm-clock-applet. – Questioner May 19 '14 at 05:11
  • @DaveMG You probably forgot to make it executable? I have it working for a week with Alarm Clock, I actually use it. – Jacob Vlijm May 19 '14 at 05:46
  • Did you delete the revised script? I thought you mentioned you had fixed the problem of Redshift over-riding your script, but I can't find that code? Also, I awarded a 50 point bounty on this because even though the accepted answer was easier to implement, I wanted to acknowledge all the work you put in on this. – Questioner May 21 '14 at 04:53
  • @DaveMG Wow, that is incredible, This is the link: https://dl.dropboxusercontent.com/u/1155139/alarm It really should work from alarm clock when you make it executable. I removed the link because it is very specific. Thank you! – Jacob Vlijm May 21 '14 at 04:58
3

Install compizconfig-settings-manager

sudo apt-get install compizconfig-settings-manager

Open CCSM and go to Effects -> Wizard, choose some key combination to turn it on/off.

enter image description here

For me it is Ctrl+Shift+Alt+W.

enter image description here

Don't forget to enable Wizard.

Now you can try it. Press Ctrl+Shift+Alt+W to turn on/off animation.

I hope this is enough blatant for you.

Do Alarm

Now go to terminal, And run:

xdotool key ctrl+shift+alt+w

If you want to run it every 20 minutes, just add this command to crontab, with exporting DISPLAY variable.

execute crontab -e, and add this line

20 * * * * export DISPLAY=:0.0 && xdotool key ctrl+alt+shift+w

May be it would be better to turn off this effects automatically, especially if you are away from computer.

This command will do the same, but after 20 seconds it turns off.

20 * * * * export DISPLAY=:0.0 && xdotool key ctrl+alt+shift+w && sleep 20 && xdotool key ctrl+alt+shift+w
c0rp
  • 9,820
  • 3
  • 38
  • 60
3

You can also use xmessage
It'll open a window that stays there until you close it.

xmessage 'Time to give my eyes a rest'

Type man xmessage for more options.

enter image description here

Parto
  • 15,325
  • 24
  • 86
  • 117
2

There also exist a program called Workrave which is used to remind you to take a break from using a computer for configured set of time. It even shows exercise to make during a break in your office chair. I don't know if Workrave is in a repository, because I don't use Ubunutu but it is a Gnome program.

MaBu
  • 21
2

Standard Desktop Notification could be used. Example:

notify-send 'Hello world!' 'This is an example notification.' --icon=dialog-information

References:

user.dz
  • 48,105
0

I have years used xcowsay. Pretty nice cow reminding and telling you whatever you want. Easy scripting:

xcowsay Hello world! --time=0 --cow-size=small
Lorenz Keel
  • 8,905