Skip to content

Commit 0df4a0b

Browse files
committed
Implemented waybar/wofi integration script
1 parent 0247fe0 commit 0df4a0b

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,8 @@ zeit export --format tyme --project "my project" --since "2020-04-01T15:04:05+07
278278
Here are a few integrations and extensions built by myself as well as other
279279
people that make use of `zeit`:
280280

281+
- [`zeit-waybar-wofi.sh`](https://github.com/mrusme/zeit/blob/main/extras/zeit-waybar-wofi.sh),
282+
a script for integrating `zeit` into waybar, using wofi
281283
- [`zeit.1m.sh`](https://github.com/mrusme/zeit/blob/main/extras/zeit.1m.sh),
282284
an [`xbar`](https://github.com/matryer/xbar) plugin for `zeit`
283285
- [`zeit-status.sh`](https://github.com/khughitt/dotfiles/blob/master/polybar/scripts/zeit-status.sh),

extras/zeit-waybar-wofi.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/sh
2+
#
3+
# Example waybar configuration:
4+
#
5+
# "custom/zeit": {
6+
# "format": "{}",
7+
# "exec": "zeit-waybar-wofi.sh",
8+
# "on-click": "zeit-waybar-wofi.sh click",
9+
# "interval": 10
10+
# },
11+
#
12+
13+
ZEIT_BIN=zeit
14+
15+
tracking=$($ZEIT_BIN tracking --no-colors)
16+
17+
if [[ "$1" == "click" ]]
18+
then
19+
if echo "$tracking" | grep -q '^ ▶ tracking'
20+
then
21+
$ZEIT_BIN finish
22+
exit 0
23+
fi
24+
25+
selection=$($ZEIT_BIN list \
26+
--only-projects-and-tasks \
27+
--append-project-id-to-task \
28+
| wofi \
29+
--dmenu \
30+
--sort-order default \
31+
--cache-file /dev/null\
32+
)
33+
34+
task=$(echo $selection | pcregrep -io1 '└── (.+) \[.+')
35+
project=$(echo $selection | pcregrep -io1 '.+\[(.+)\]')
36+
37+
if [[ "$task" == "" ]] || [[ "$project" == "" ]]
38+
then
39+
exit 1
40+
fi
41+
42+
$ZEIT_BIN track -p "$project" -t "$task"
43+
exit 0
44+
fi
45+
46+
echo -n $tracking
47+

0 commit comments

Comments
 (0)