回答:
NotifyOSDチームが通知にサウンドを追加するために時間をかけているので、特定のユースケースに十分に対応できるスクリプトを次に示します。
(システムがスリープ状態になったときにビープ音だけが通知されます。恐れ入りますが、すべての通知ではビープ音は鳴りません...)
次のスクリプトをコピーして貼り付けます。
#!/bin/bash
#
# This script plays a sound if the system is going into hibernation/sleep mode
# as an answer to http://askubuntu.com/questions/552999/how-to-warn-noise-bleep-when-ubuntu-is-about-to-go-into-sleep-mode/553026
# Original script name: /etc/pm/sleep.d/sleep-beep
#
# Copyright (c) Fabby 2015
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. See the GNU General Public License for more details.
# You DID NOT receive a copy of the GNU General Public License along with this program as the license is bigger then this program.
# Therefore, see http://www.gnu.org/licenses/ for more details.
case $1 in
suspend|suspend_hybrid|hibernate)
notify-send --urgency=NORMAL --icon=face-tired "Going to sleep"
ogg123 /usr/share/sounds/ubuntu/stereo/desktop-login.ogg
;;
resume|thaw)
# No need to do anything here, but easy to add if needed
;;
esac
に gedit
sleep-beep
Documentsディレクトリに保存しますスクリプトを実行可能にして、正しいディレクトリにコピーします。
sudo chmod +x ~/Documents/sleep-beep
sudo cp ~/Documents/sleep-beep /etc/pm/sleep.d/sleep-beep
コマンドラインからoggファイルを再生する必要があるため、以下も必要です。
sudo apt-get install vorbis-tools