-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented waybar/wofi integration script
- Loading branch information
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|