作者idisnothing ()
看板Linux
標題[問題] notification daemon & icewm
時間Mon Apr 2 23:27:49 2018
Hi~
剛寫了一個簡單的script
可以用來調整音量並顯示一個通知在桌面上
內容如下
============================================================
#! /bin/bash
# /usr/local/bin/AdjustVolume.sh
if [ ${1} == "Up" ]; then
amixer -q sset PCM 2dB+
elif [ ${1} == "Down" ]; then
amixer -q sset PCM 2dB-
else
amixer -q sset PCM toggle
fi
VOL=$(amixer | tail -1 | tr -s ' ' | cut -d ' ' -f 6,7,8)
notify-send "Volume: $VOL"
exit 0
============================================================
功能大致上沒什麼問題
但有個小困擾就是顯示在桌面上的通知都會持續近十秒才消失(或顯示下一則通知)
如果我連降三次音量的話那要在30秒後才看得到調整過後真正的的音量
這樣實在太久了
有試過notify-send加-t 1000參數
但目前用的notification daemon (notify-osd)不吃這個參數(notify-send manpage上寫的)
所以加了也沒用
想請教還有其它推薦的notification daemon嗎?
我系統裡有notification-daemon這個package
在裝notify-osd之前有試過
ps aux看得到它
所以確定daemon是有在run的
但不知為何就是沒反應
另外我的WM是icewm
我有設定一些快速鍵
這些快速鍵會利用上述的script來調整音量並顯示通知
鍵盤的開始鍵+數字區的加號 ==> 調大聲
鍵盤的開始鍵+數字區的減號 ==> 調小聲
鍵盤的開始鍵+數字區的零 ==> 靜音/取消靜音
內容如下
============================================================
# ~/.icewm/keys
key "Super+KP_Subtract" AdjustVolume.sh Down
key "Super+KP_Add" AdjustVolume.sh Up
key "Super+KP_Zero" AdjustVolume.sh Toggle
============================================================
調大小聲的部份沒問題
但靜音切換沒反應
我想問題應該是在KP_Zero這裡
有人知道要怎麼改才能正確作動嗎?
謝謝~~~
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 220.132.185.53
※ 文章網址: https://www.ptt.cc/bbs/Linux/M.1522682871.A.A5D.html
→ idisnothing: 這是我剛錄下的影片 影片的一開始連按三下開始鍵+ 04/02 23:54
→ idisnothing: 減號來調整音量 但每一個notification都顯示了近10s 04/02 23:55
→ idisnothing: 才換下一個 04/02 23:55
→ idisnothing: 對了 OS是Ubuntu 16.04 04/03 00:03
→ idisnothing: 第二個問題解決了 /usr/share/icewm/keys裡頭寫到各 04/03 01:06
→ idisnothing: 個鍵的symbol可以去查keysym.h 所以我就GOOGLE一份 04/03 01:07
→ idisnothing: keysym.h來看 發現數字區0這顆按鍵的symbol原來不是 04/03 01:08
→ idisnothing: KP_Zero也不是KP_0 而是KP_Insert 改成KP_Insert後 04/03 01:08
→ idisnothing: 按開始鍵+數字區0就能mute/unmute了 04/03 01:08
推 ddtsatan: 推 04/03 14:37
→ idisnothing: 第一個問題也解決了 GOOGLE到上面那篇 04/03 20:07
→ idisnothing: notify-send加個參數-h string:x-canonical-private- 04/03 20:07
→ idisnothing: synchronous:anything就OK了 舊的通知會馬上被新的通 04/03 20:08
→ idisnothing: 知取代 而且最新的通知會顯示個3秒左右 時間剛剛好~ 04/03 20:09
→ idisnothing: 參數最後anything好像可以改成任何單字 有空再仔細 04/03 20:19
→ idisnothing: 看看notify-osd的ubuntu wiki 04/03 20:19
※ 編輯: idisnothing (220.132.185.53), 04/03/2018 22:28:31
※ 編輯: idisnothing (220.132.185.54), 04/05/2018 02:04:50