Daily development skills: Use notify-send to send notifications

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.