-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:rcaelers/workrave
- Loading branch information
Showing
3 changed files
with
66 additions
and
2 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
11 changes: 11 additions & 0 deletions
11
contrib/waybar-yambar-poss-other-applets/swaybar/workrave-swaybar.sh
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,11 @@ | ||
#!/bin/sh | ||
|
||
~/bin/workrave_swaybar_gen_json.py & | ||
|
||
# Listening for STDIN events | ||
while read line; | ||
do | ||
if [[ $line == *"name"*"workrave"* ]]; then | ||
~/bin/workrave-open.py | ||
fi | ||
done |
37 changes: 37 additions & 0 deletions
37
contrib/waybar-yambar-poss-other-applets/swaybar/workrave_swaybar_gen_json.py
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,37 @@ | ||
#!/usr/bin/env python3 | ||
|
||
polling_interval = 1.0 | ||
date_format = "%a %b %d, %I:%M %p" | ||
|
||
import json | ||
import sys | ||
import time | ||
from datetime import datetime | ||
|
||
from workrave_break_info import fmt_timer_plain, WorkraveBreakInfo | ||
|
||
wr_break_info = WorkraveBreakInfo(color_dict = { | ||
"default": ("#000000", "#87CEEB"), | ||
"close to break": ("#000000", "#FFA500"), | ||
"overdue": ("#FFFFFF", "#FF0000") | ||
}) | ||
|
||
print('{ "version": 1, "click_events": true}\n[') | ||
|
||
while True: | ||
print("[") | ||
|
||
for timer_type in ("microbreak", "restbreak", "dailylimit"): | ||
timer_info = wr_break_info.get_timer_info(timer_type) | ||
|
||
if timer_info.enabled: | ||
print(f' {{"full_text": "{fmt_timer_plain(*timer_info)}", ' | ||
f'"name": "workrave", "instance": "wr_{timer_type}", ' | ||
f'"color": "{timer_info.colors[0]}", ' | ||
f'"background": "{timer_info.colors[1]}"}},') # Note comma at end | ||
|
||
print(f' {{"full_text": "{datetime.now().strftime(date_format)}"}}') | ||
|
||
print("],", flush = True) | ||
|
||
time.sleep(polling_interval) |