README.md (3159B)
1 # undistract-me 2 3 Notifies you when long-running terminal commands complete. 4 5 ## What is this? 6 7 Does this ever happen to you? 8 9 You're doing some work, and as part of that you need to run a command on the 10 terminal that takes a little while to finish. You run the command, watch it 11 for maybe a second and then switch to doing something else – checking 12 email or something. 13 14 You get so deeply involved in your email that twenty minutes fly by. When 15 you switch back to your terminal the command has finished, but you've got no 16 idea whether it was nineteen seconds ago or nineteen *minutes* ago. 17 18 This happens to me a lot. I'm just not disciplined enough to sit and watch 19 commands, and I'm not prescient enough to add something to each invocation to 20 tell me. What I want is something that alerts me whenever long running 21 commands finish. 22 23 This is it. 24 25 Install this, and then you'll get a notification when any command finishes 26 that took longer than ten seconds to finish. 27 28 ## Installation 29 30 ### From the Ubuntu repositories 31 32 $ sudo apt install undistract-me 33 34 ### From the branch 35 36 $ bzr checkout --lightweight lp:undistract-me 37 $ . undistract-me/long-running.bash 38 $ notify_when_long_running_commands_finish_install 39 40 ### Add to your Bash 41 42 $ echo 'source /etc/profile.d/undistract-me.sh' >> ~/.bashrc 43 44 ## Configuration 45 46 By default, a long-running command is any command that takes more than 10s to 47 complete. If this default is not right for you, set 48 `LONG_RUNNING_COMMAND_TIMEOUT` to a different number of seconds and export it. 49 It is possible to disable notifications for certain commands by adding them 50 space-separated to `LONG_RUNNING_IGNORE_LIST` variable. 51 52 By default, the notification will only show if the active window is not the 53 window the command is running in. If this is not right for you, (eg. if you 54 are an Emacs user), you can set IGNORE_WINDOW_CHECK to 1 to skip the window 55 check. 56 57 In addition to a visual notification, you can make undistract-me notify you 58 by playing an audible sound along with the notification popup by simply 59 setting the variable UDM_PLAY_SOUND to a non-zero integer on the command line. 60 This functionality requires that pulseaudio-utils and sound-theme-freedesktop 61 (which provides the notification sound file) be installed on a Debian-based 62 system. 63 64 ## Licensing 65 66 All of undistract-me, including this file, is made available with the Expat 67 license. See `LICENSE` for details. 68 69 ## Getting help 70 71 There's no dedicated IRC channel, but feel free to ping `jml` on Freenode, 72 probably in the `#ubuntu-devel` channel. 73 74 Alternatively, ask questions or file bugs on the 75 [undistract-me](https://launchpad.net/undistract-me) Launchpad project. 76 77 ## Credits 78 79 [Glyph Lefkowitz](http://glyph.twistedmatrix.com/) wrote 80 [a neat hack to provide ZSH-like preexec support for bash](http://glyf.livejournal.com/63106.html). 81 82 A lot of help from [Chris Jones](http://www.tenshu.net/) of 83 [Terminator](http://www.tenshu.net/p/terminator.html). 84 85 [Mikey Neuling](https://github.com/mikey/) and Stephen Rothwell have made huge 86 improvements to the performance and quality of the shell script. I'm amazed, 87 humbled and grateful.