Implemented waybar/bemenu script

This commit is contained in:
マリウス 2022-08-29 16:23:45 -05:00
parent a854eb5bdb
commit 9ec81a1a3c
No known key found for this signature in database
GPG key ID: 272ED814BF63261F
2 changed files with 51 additions and 1 deletions

View file

@ -278,8 +278,14 @@ zeit export --format tyme --project "my project" --since "2020-04-01T15:04:05+07
Here are a few integrations and extensions built by myself as well as other Here are a few integrations and extensions built by myself as well as other
people that make use of `zeit`: people that make use of `zeit`:
- [`zeit-waybar-bemenu.sh`](https://github.com/mrusme/zeit/blob/main/extras/zeit-waybar-bemenu.sh),
a script for integrating `zeit` into
[waybar](https://github.com/Alexays/Waybar), using
[bemenu](https://github.com/Cloudef/bemenu)
- [`zeit-waybar-wofi.sh`](https://github.com/mrusme/zeit/blob/main/extras/zeit-waybar-wofi.sh), - [`zeit-waybar-wofi.sh`](https://github.com/mrusme/zeit/blob/main/extras/zeit-waybar-wofi.sh),
a script for integrating `zeit` into waybar, using wofi a script for integrating `zeit` into
[waybar](https://github.com/Alexays/Waybar), using
[wofi](https://hg.sr.ht/~scoopta/wofi)
- [`zeit.1m.sh`](https://github.com/mrusme/zeit/blob/main/extras/zeit.1m.sh), - [`zeit.1m.sh`](https://github.com/mrusme/zeit/blob/main/extras/zeit.1m.sh),
an [`xbar`](https://github.com/matryer/xbar) plugin for `zeit` an [`xbar`](https://github.com/matryer/xbar) plugin for `zeit`
- [`zeit-status.sh`](https://github.com/khughitt/dotfiles/blob/master/polybar/scripts/zeit-status.sh), - [`zeit-status.sh`](https://github.com/khughitt/dotfiles/blob/master/polybar/scripts/zeit-status.sh),

44
extras/zeit-waybar-bemenu.sh Executable file
View file

@ -0,0 +1,44 @@
#!/bin/sh
#
# Example waybar configuration:
#
# "custom/zeit": {
# "format": "{}",
# "exec": "zeit-waybar-bemenu.sh",
# "on-click": "zeit-waybar-bemenu.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 \
--only-tasks \
--append-project-id-to-task \
| bemenu -p ' ' -P '▶'
)
task=$(echo $selection | pcregrep -io1 '(.+) \[.+')
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