How To Get Notifications For Terminal Commands On Linux
Need a reminder for when your terminal command completes? Check out Undestract-me! It can send you notifications for Terminal commands when they complete.
The Undistract Me tool works with every Linux desktop environment’s notification system and is highly customizable. Better yet, it has support on nearly every mainstream Linux distribution! To install the software, open up a terminal and enter the commands that correspond to your operating system.
Note: to install this software on your system, you need to be using Ubuntu, Debian, Arch Linux, Fedora or Open SUSE.
Ubuntu
sudo apt-get install undistract-me
Debian
sudo apt-get install undistract-me
Arch Linux
Undistract Me is available on Arch Linux, though it’s not in the official software sources. Instead, if you’re looking to get this working on Arch, you’ll need to download the AUR package.
Building the AUR package is quite easy, and it starts out by using the Pacman tool to install a few packages. Open up a terminal and install Git and Base-devel.
sudo pacman -S base-devel git
Now that Git and Base-devel are on the system, the AUR setup can begin. Using the Git tool, clone the Undestract Me snapshot to your Linux PC.
git clone https://aur.archlinux.org/undistract-me-git.git
Move the terminal into the undistract-me-git folder with the CD command.
cd undistract-me-git
In the folder, run the makepkg command and generate a new installable package. Keep in mind that when building packages from the AUR, dependencies sometimes fail to install. If this happens, fix it by installing missing dependencies manually. Find the dependencies here.
makepkg -si
Fedora
Currently, there aren’t any installable packages of Undistract Me on Fedora Linux. Those looking to get it running should follow the “Generic Linux” instructions instead.
OpenSUSE
Like Fedora, there isn’t currently a release of Undistract Me for OpenSUSE Linux. Please follow the “Generic Linux” instructions below, as it outlines how to install from source.
Generic Linux
The source code for Undistract Me is on Github, as well as Launchpad. On the development page, the readme states that users should grab the code with “bzr,” and not Git. To interact with code via Bzr, you must install the “Bzr” package. Thankfully, most Linux distributions have this tool available.
Note: if Bzr fails to work correctly, an alternative is to manually download Undistract Me here, via Github.
Fedora
sudo dnf install bzr
OpenSUSE
sudo zypper install bzr
Other Linuxes
As Undistract Me ultimately just works within an existing desktop’s notification system, the “Bzr” tool is the only software users need to make it work. To get Bzr working, check your operating system’s software repository. if you can’t find it, there are many binary downloads for Bzr on Pkgs.org.
With Bzr working on your system, open up a terminal and use the tool to grab the latest version of the code.
Note: while running the “bzr checkout” command, you may see a warning to “log in”. Only log in if you plan to contribute code. Otherwise, ignore it, and continue on.
sudo bzr checkout --lightweight lp:undistract-me
Running bzr checkout clones the latest version of the code from the repo down to your Linux PC. From here, use the CD command and move the terminal into the code folder.
cd undistract-me
Update all of the files in the code folder, so that the system will run it correctly.
sudo chmod +x *
In the code folder, try to run the script and start it up. Understand that when you close the terminal, the script will stop running.
./undistract-me.sh
To close the script, press Ctrl + Z, then write disown.
Set Up Undistract Me
Undistract Me needs to be set up in Bash before it works. If you’ve installed the software on Ubuntu, Arch or Debian, don’t worry! The automatic build system comes with setup instructions, including applying the software to your user’s Bash profile. Only follow the instructions below if you built the software from source.
To set up Undistract Me after building it from source, open up a terminal and enter the following commands below.
cd undistract-me sudo mv undistract-me.sh /etc/profile.d/
cp ~/.bashrc ~/Documents/.bashrc-bakup
echo 'source /etc/profile.d/undistract-me.sh' >> ~/.bashrc
Be sure to run this setup command for every user you want to give access to undistract me.
When the setup command finishes, reboot your Linux PC. After logging back in, the notification system will start working.
Uninstall Undistract Me
If the Undistract Me doesn’t suit your workflow, you may wish to disable it. Thankfully, shutting off Undistract Me is quite simple. To do it, open up a terminal and follow the commands below.
Ubuntu
sudo apt remove undistract-me --purge
Debian
sudo apt-get remove undistract-me --purge
Arch Linux
sudo pacman -Rsc undistract-me
Source Instructions
sudo rm -rf /etc/profile.d/undistract-me/ rm ~/.bashrc mv ~/Documents/.bashrc-bakup ~/.bashrc sudo reboot
Doesn’t notify-osd does this already on every single linux distro?
Or you can do…
$ some-cmd && notify-send “some-cmd is done”