5

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?

1

7 Answers 7

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.

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
1
  • 1
    This is awesome on so many levels! Yes, definitely blatant enough.
    – Questioner
    May 12, 2014 at 8:17
3
+50

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
    
6
  • 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, 2014 at 8:03
  • Done! made the script colour your screen +dim, with an option to (endlessly) cycle, unless you tell it to dismiss. May 12, 2014 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, 2014 at 5:11
  • @DaveMG You probably forgot to make it executable? I have it working for a week with Alarm Clock, I actually use it. May 19, 2014 at 5: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, 2014 at 4:53
2

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

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.

1

Standard Desktop Notification could be used. Example:

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

References:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.