added (go)jq and updated!

This commit is contained in:
mertoalex 2024-02-13 02:14:21 +03:00
parent c6943e7487
commit 99513bc0a0
3 changed files with 35 additions and 11 deletions

View File

@ -1,23 +1,26 @@
# herbed-tiramisu
tiramisu wrapper(?) for herbe (desktop notification tools)
tiramisu working with herbe in a script <br/>
needs tiramisu, herbe and jq or gojq
## for installing
```
make #default install
```
## for uninstallimg
## for uninstalling
```
make uninstall
```
## make parameters
PREFIX = string : prefix to install (default "/usr/local") <br/>
asroot = string : program that runs as root (default sudo, doas works)
PREFIX = string : prefix to install (default "/usr/local"). <br/>
asroot = string : program that runs as root (default sudo, doas works).
## thanks for
[Sweets](https://github.com/Sweets) for [tiramisu](https://github.com/Sweets/tiramisu) <br/>
[dudik](https://github.com/dudik) for [herbe](https://github.com/dudik/herbe)
[Sweets](https://github.com/Sweets) for [tiramisu](https://github.com/Sweets/tiramisu). <br/>
[dudik](https://github.com/dudik) for [herbe](https://github.com/dudik/herbe).
## notes
I first tried this in wayland with xwayland, I think It's work well in xwayland.
I first tried this in wayland with xwayland, I think It's work well in xwayland. <br/>
I recommend [that](http://git.vern.cc/mertoalex/herbe-title-patched) fork/patch/whatever. <br/>
[herbed-tiramisu.old](./herbed-tiramisu.old) script was first try of that script.

11
herbed-tiramisu.old Normal file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env bash
#thanks to anufrievroman for style (https://github.com/anufrievroman/polytiramisu/blob/9c0a039d8cd8b7066bccbbd237cd8939da66e1fb/polytiramisu.sh#L18)
tiramisu -o "export timeout='#timeout' app='#source' message='#summary'" |
while read -r tiramisu
do $tiramisu
#grep "-" &>/dev/null <<< $timeout && export timeout=1
#herbe &> /dev/null || :
#timeout -s9 ${timeout}s herbe "App: $app" "" "Message: $message"
done

View File

@ -1,9 +1,19 @@
#!/usr/bin/env bash
[ -z $JQ ] && \
{ command -v gojq &> /dev/null && JQ=gojq;} || \
{ command -v jq &> /dev/null && JQ=jq;} || \
{ echo "No jq found."; exit 1;}
#thanks to anufrievroman for style (https://github.com/anufrievroman/polytiramisu/blob/9c0a039d8cd8b7066bccbbd237cd8939da66e1fb/polytiramisu.sh#L18)
tiramisu -o "export timeout=#timeout app=#source message=#summary" |
tiramisu -j |
while read -r tiramisu
do $tiramisu
timeout -s9 ${timeout}s herbe "App: $app" "" "Message: $message"
while read -r jsonData
do timeout="$($JQ -r '.timeout' <<< $jsonData)"
source="$($JQ -r '.source' <<< $jsonData)"
summary="$($JQ -r '.summary' <<< $jsonData)"
body="$($JQ -r '.body' <<< $jsonData)"
grep "-" &>/dev/null <<< $timeout && export timeout=1
herbe &> /dev/null || :
timeout -s9 ${timeout}s herbe "$source" "$summary" $'\n' "$body"
done