指定與 grolnotify 命令列公用程式一起使用的顯示樣式

指定與 grolnotify 命令列公用程式一起使用的顯示樣式

growlnotify有什麼方法可以更改命令列實用程式使用的顯示樣式嗎?我不想更改預設值,只想更改用於該命令實例的值。

答案1

man growlnotify不允許有選項,也growlnotify --help沒有提及任何內容。這是有道理的,因為發行軟體不控制風格,你是——透過系統偏好設定!

growlnotify那裡的條目只有單一通知類型Command-Line Growl Notification(而不是例如每個優先權一種通知類型)。所以我認為這是不可能的


但是,您可以建立 AppleScript 應用程式/腳本,它使用 Growl API 根據某些參數發出不同類型的通知。有關如何透過 AppleScript 存取它的 Growl 文檔

以下是 AppleScript 編輯器的範例腳本:

on run argv
    tell application "GrowlHelperApp"
        set the allNotificationsList to ¬
            {"1", "2"}
        set the enabledNotificationsList to ¬
            {"1", "2"}
        register as application ¬
            "My Growl Notification App" all notifications allNotificationsList ¬
            default notifications enabledNotificationsList ¬
            icon of application "Script Editor"

        notify with name ¬
            (item 1 of argv) title ¬
            (item 2 of argv) description ¬
            (item 3 of argv) application name "My Growl Notification App"
    end tell
end run

“1”和“2”是支援的通知類型的名稱。像這樣運行這個腳本:

osascript growlstyle.scpt 2 Hello\ World This\ is\ the\ text

參數是(按順序)通知類型名稱、標題和描述。

替代文字

運行一次後,您可以在系統偏好設定中配置通知類型的顯示設定。

替代文字

相關內容