2021-07-06 00:44:32 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Example waybar configuration:
|
|
|
|
#
|
|
|
|
# "custom/zeit": {
|
|
|
|
# "format": "{}",
|
|
|
|
# "exec": "zeit-waybar-wofi.sh",
|
|
|
|
# "on-click": "zeit-waybar-wofi.sh click",
|
|
|
|
# "interval": 10
|
|
|
|
# },
|
|
|
|
#
|
|
|
|
|
|
|
|
ZEIT_BIN=zeit
|
|
|
|
|
|
|
|
tracking=$($ZEIT_BIN tracking --no-colors)
|
|
|
|
|
|
|
|
if [[ "$1" == "click" ]]
|
|
|
|
then
|
|
|
|
if echo "$tracking" | grep -q '^ ▶ tracking'
|
|
|
|
then
|
|
|
|
$ZEIT_BIN finish
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
selection=$($ZEIT_BIN list \
|
2022-04-15 00:15:31 +00:00
|
|
|
--only-tasks \
|
2021-07-06 00:44:32 +00:00
|
|
|
--append-project-id-to-task \
|
|
|
|
| wofi \
|
|
|
|
--dmenu \
|
|
|
|
--sort-order default \
|
|
|
|
--cache-file /dev/null\
|
|
|
|
)
|
|
|
|
|
2022-04-15 00:15:31 +00:00
|
|
|
task=$(echo $selection | pcregrep -io1 '(.+) \[.+')
|
2021-07-06 00:44:32 +00:00
|
|
|
project=$(echo $selection | pcregrep -io1 '.+\[(.+)\]')
|
|
|
|
|
|
|
|
if [[ "$task" == "" ]] || [[ "$project" == "" ]]
|
|
|
|
then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
$ZEIT_BIN track -p "$project" -t "$task"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo -n $tracking
|
|
|
|
|