Skip to content

Commit

Permalink
Implemented waybar/wofi integration script
Browse files Browse the repository at this point in the history
  • Loading branch information
mrusme committed Jul 6, 2021
1 parent 0247fe0 commit 0df4a0b
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ 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
people that make use of `zeit`:

- [`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
- [`zeit.1m.sh`](https://github.com/mrusme/zeit/blob/main/extras/zeit.1m.sh),
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),
Expand Down
47 changes: 47 additions & 0 deletions extras/zeit-waybar-wofi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/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 \
--only-projects-and-tasks \
--append-project-id-to-task \
| wofi \
--dmenu \
--sort-order default \
--cache-file /dev/null\
)

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

0 comments on commit 0df4a0b

Please sign in to comment.