Background
When the terminal executes some commands that take a long time, it will switch to another interface. But in order to know whether the execution is complete, you need to switch from time to take a look. Very troublesome.
Solution
To reduce this problem, you can use notify-send to send desktop notifications. Sending y-send is very simple to use, and you just need to add the prompt content.
For example, when executing make, you can replace it
Make & Policy-Send "compiled"
Of course, it is quite troublesome to manually enter notify-Send each time. Frequently Used functions can be encapsulated into Shell functions. Get your own name.
For example, I use m as the make function and input m every time.
M () {make-j32 [email protected] & Policy-Send "compiled "}
Notes
If you are logging on to a remote server via SSH, you need to use the X11-forward when logging on via SSH, otherwise you will not be able to see it remotely using the Y-Send local.
In ~ Add the configuration in/. Ssh/config, as shown in figure
Host CShostname 192.168.12.34user zhuangqiubinForwardX11 yesForwardX11Trusted yes
If you want to call the function regularly in cron, you need to set display =: 0.0 first, as shown in figure
00 12 *** export display =: 0.0 & Policy-Send "Have dinner"
Others
Notify-send also has many parameters, such as time and icons. You can view the help or online search tutorials if necessary.
Daily development skills: Use notify-send to send notifications