Created
March 10, 2020 10:52
-
-
Save madprops/3cea71cefabd9166d3b70a73f53bfafb to your computer and use it in GitHub Desktop.
Script to easily make naughty notifications ( awesome wm) when using bash scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Arguments: title message icon timeout mode | |
# If mode is 'update' it will update an existing notification with the same title | |
# Example usage: ~/scripts/notify.sh 'Audio Volume' ${vol} ~/scripts/music.jpg 2 update | |
awesome-client 'naughty = require("naughty") | |
local title = "'"$1"'" | |
local message = "'"$2"'" | |
local icon = "'$(realpath "$3")'" | |
local timeout = tonumber("'"$4"'") | |
local mode = "'"$5"'" | |
if mode == "update" then | |
for k, n in ipairs(naughty.active) do | |
if n.title == title then | |
n.message = message | |
return | |
end | |
end | |
end | |
naughty.notification({title = title, message = message, icon = icon, timeout = timeout})' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment