7
$\begingroup$

I have a somewhat long computation running in the background. I would like the Mathematica icon on the taskbar to flash once the computation is done. For example, Microsoft Outlook reminders make the taskbar flash:

enter image description here

How can I achieve the same effect in Mathematica? Is there a Mathematica command that makes the Mathematica icon in the taskbar flash?

What I've tried: Beep[] can be useful, but if you leave the computer for a while, you can miss the beep. The advantage of flashing is that it remains flashing indefinitely. Another alternative is MessageDialog[], but you have no way of knowing that a message is up if Mathematica is minimized. It would be useful if MessageDialog[] produced the flashing in the taskbar, but that doesn't happen.

Update: Opening a SystemDialogInput is a hammer type of solution, although it gets the job done. I am reopening this question in case someone else comes up with something more subtle. The goal is to have some sort of alert that doesn't stop (like a beep would), so that if I leave the computer, when I return I could instantly see if the computation is done.

By the way, I am on Linux Mint, in case someone wants to get really low level :)

$\endgroup$
9
  • 1
    $\begingroup$ I don't think there are some commands that make the icon flash, but I usually add Beep[] at the end of code if it will take long time to compute. $\endgroup$
    – mmjang
    Commented Jan 14, 2014 at 16:20
  • $\begingroup$ @mm.Jang The problem with Beep[] is that if you leave the computer for a while and return, and you can miss the beep. The icon flashing remains flashing indefinitely. $\endgroup$
    – a06e
    Commented Jan 14, 2014 at 16:25
  • 5
    $\begingroup$ This is OS dependent and not specific to Mathematica. You might have better luck on Super User. If you're trying to set up a notification when the computation is finished, then you can perhaps use my answer here: Automatic e-mail/text message when a calculation has finished? $\endgroup$
    – rm -rf
    Commented Jan 14, 2014 at 16:33
  • 1
    $\begingroup$ I'm running Mac OS X and if Mathematica is hidden then using SystemDialogInput["FileSave"] makes the Dock icon bounce. Perhaps under Windows it will flash the Taskbar icon? $\endgroup$ Commented Jan 14, 2014 at 17:06
  • 1
    $\begingroup$ @becko What rm-rf meant (I believe) is that since Mathematica does not contain built-in functionality for this, the question would be the very same for any other software: how do you make the taskbar button of a particular program flash? Not meaning to say that this should be closed here (it would be very useful to have what you're asking for), but you are indeed more likely to get an answer on superuser.com. $\endgroup$
    – Szabolcs
    Commented Jan 14, 2014 at 19:09

2 Answers 2

9
$\begingroup$

This is perhaps not a completely satisfactory solution but it is Mathematica based.

Unlike MessageDialog[]

SystemDialogInput["FileSave"]

will make the Taskbar icon flash in Windows and the Dock icon bounce in Mac OS X under certain conditions. (I believe the document must be minimised in Windows or hidden in Mac.)

Of course it has the slight side-effect of bringing up a file selection dialog but this could be used to ensure that the results of your long computations are saved to a file, e.g.

result = MyLongComputation[];
Export[SystemDialogInput["FileSave", WindowTitle -> "Computation Complete"], result]

Using the WindowTitle option should also make the sudden appearance of the dialog box less likely to be confusing.

$\endgroup$
1
  • $\begingroup$ +1 Good idea. Converting the file selection dialog into something useful makes sense. $\endgroup$
    – a06e
    Commented Jan 15, 2014 at 14:41
2
$\begingroup$

You can achieve this by upgrading to Mathematica 11 :)

$\endgroup$
5
  • 4
    $\begingroup$ The requested behavior is built into v11 on Windows. So depending on your point of view, it does actually answer the question. $\endgroup$
    – ihojnicki
    Commented Nov 18, 2016 at 21:51
  • $\begingroup$ How exactly? I have Mathematica 11. Note that I am on Linux Mint. Are you saying that in Windows, MessageDialog flashes the taskbar? Please expand. $\endgroup$
    – a06e
    Commented Nov 18, 2016 at 21:51
  • 3
    $\begingroup$ @becko Just evaluate Pause[10] and task switch to some other app. The icon should flash after roughly 10 seconds. $\endgroup$
    – ihojnicki
    Commented Nov 18, 2016 at 21:53
  • $\begingroup$ @becko This behavior does not exist on Linux in v11. I can forward that on if you are interested... $\endgroup$
    – ihojnicki
    Commented Nov 18, 2016 at 21:54
  • $\begingroup$ The behavior does exist in v11 on Linux, but for me it keeps bugging, such that I will see it blinking on all my workspaces, until I close the notebook. Thus I am looking for ways of removing this setting. $\endgroup$
    – a20
    Commented Sep 28, 2021 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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