Jawaban:
Ada banyak fitur keren lainnya notify-send
Kami dapat menjalankan perintah dan membuatnya ditampilkan di pemberitahuan:
notify-send <title> <`command`>
notify-send Date "`date`"
notify-send Disk "`df / -H`"
Kita dapat menggunakan ikon dengan notifikasi
notify-send -i <icon> <Message>
notify-send -i face-wink "Hello! January"
Pop up benar-benar menjengkelkan
notify-send -t 0 "Bringing down the system"
dan
notify-send <title> <message>
notify-send "who am i" "I am January"
Untuk opsi lebih lanjut, periksa di sini
notify-send -t 0
berfungsi tetapi notify-send "who am i" "I am January"
tidak bekerja :( - di ubuntu 15.10
--urgency=critical
sudo apt install libnotify-bin
.
Hanya untuk menambah jawaban lain, saat menjalankan perintah secara lokal dari cron, saya menggunakan
DISPLAY=:0.0 /usr/bin/notify-send "TITLE" "MESSAGE"
Saya menemukan yang satu itu secara kebetulan. Jawab: gunakan program notify-send
:
notify-send "Hello world!"
Saya membuat skrip sederhana dan hampir asli yang memainkan Suara dan menampilkan Pemberitahuan dengan Pesan dan Waktu yang Diberikan untuk Ubuntu ( Inti ):
#!/bin/sh
# https://gist.github.com/John-Almardeny/04fb95eeb969aa46f031457c7815b07d
# Create a Notification With Sound with a Given Message and Time
# The Downloaded Sound is from Notification Sounds https://notificationsounds.com/
MSSG="$1"
TIME="$2"
# install wget if not found
if ! [ -x "$(command -v wget)" ]; then
echo -e "INSTALLING WGET...\n\n"
sudo apt-get install wget
echo -e "\n\n"
fi
# install at package if not found
if ! [ -x "$(command -v at)" ]; then
echo -e "INSTALLING AT...\n\n"
sudo apt-get install at
echo -e "\n\n"
fi
# install sox if not found
if ! [ -x "$(command -v sox)" ]; then
echo -e "INSTALLING SOX...\n\n"
sudo apt-get install sox
sudo apt-get install sox libsox-fmt-all
echo -e "\n\n"
fi
# download the noti sound if this is first time
# add alias to the bashrc file
if ! [ -f ~/noti/sound.mp3 ]; then
echo -e "DOWNLOADING SOUND...\n\n"
touch ~/noti/sound.mp3 | wget -O ~/noti/sound.mp3 "https://notificationsounds.com/wake-up-tones/rise-and-shine-342/download/mp3"
sudo echo "alias noti=\"sh ~/noti/noti.sh\"" >> ~/.bashrc
source ~/.bashrc
echo -e "\n\n"
fi
# notify with the sound playing and particular given message and time
echo "notify-send \""$MSSG\"" && play ~/noti/sound.mp3" | at $TIME
Buat Direktori baru di rumah Anda dan sebut saja noti
mkdir ~/noti
Unduh noti.sh dan ekstrak ke noti
dir di atas .
Buka Terminal dan Ubah Direktori untuk noti
cd ~/noti
Jadikan noti.sh dapat dieksekusi dengan mengeluarkan:
sudo chmod +x noti.sh
Jalankan Tes seperti ini:
sh ~/noti/noti.sh "Test" "now"
noti "Hello From Noti" "now +1 minute"
noti "Hello From Noti" "now +5 minutes"
noti "Hello From Noti" "now + 1 hour"
noti "Hello From Noti" "now + 2 days"
noti "Hello From Noti" "4 PM + 2 days"
noti "Hello From Noti" "now + 3 weeks"
noti "Hello From Noti" "now + 4 months"
noti "Hello From Noti" "4:00 PM"
noti "Hello From Noti" "2:30 AM tomorrow"
noti "Hello From Noti" "2:30 PM Fri"
noti "Hello From Noti" "2:30 PM 25.07.18"
sudo apt-get update; noti "Done" "now"
face-wink
yang Anda gunakan?