| #!/bin/sh
|
|
|
| # include common definitions
|
| # shellcheck source=configs/default_hooks/sxmo_hook_icons.sh
|
| . sxmo_hook_icons.sh
|
| # shellcheck source=scripts/core/sxmo_common.sh
|
| . sxmo_common.sh
|
|
|
| finalize() {
|
| kill $MONPID
|
| }
|
|
|
| trap 'finalize' TERM INT
|
|
|
|
|
| # Send the header so that i3bar knows we want to use JSON:
|
| echo '{ "version": 1, "click_events": true }'
|
|
|
| # Begin the endless array.
|
| echo '['
|
|
|
| # We send an empty first array of blocks to make the loop simpler:
|
| echo '[]'
|
|
|
| sxmo_status_watch.sh -o pango | while read -r line;
|
| do
|
| # Sanitise input
|
| line="$(echo $line | sed 's/"/'\''/g')"
|
| printf ",[{\"name\": \"sxmobar\", \"full_text\": \"%s\", \"markup\": \"pango\", \"align\": \"right\"}]\n" "$line"
|
| done &
|
| MONPID=$?
|
|
|
| # Listening for STDIN events
|
| while read click_line;
|
| do
|
| # echo $line > /tmp/tmp.txt
|
| # on click, we get from STDIN :
|
| # {"name":"id_time","button":1,"modifiers":["Mod2"],"x":2982,"y":9,"relative_x":67,"relative_y":9,"width":95,"height":22}
|
|
|
| case $click_line in
|
| *"name"*"sxmobar"*)
|
| notify-send "Test Complete!" &
|
| ;;
|
| esac
|
| done
|