-
-
Save nicodebo/181f5135af9585e6f2c0fd05533b8004 to your computer and use it in GitHub Desktop.
waybar, remind module example
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
"custom/remind": { | |
"format": "Rem: {}", | |
"tooltip": true, | |
"interval": 300, | |
"exec": "/path/to/waybar-remind.py", | |
"return-type": "json" | |
}, |
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
#custom-remind { | |
padding: 0 10px; | |
margin: 0 0px; | |
color: #ffffff; | |
background-color: #f0932b; | |
} |
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
#!/usr/bin/env python | |
import os | |
import subprocess | |
import tempfile | |
import glob as gb | |
import json | |
data = {} | |
rem_file = os.path.join(os.environ['XDG_CONFIG_HOME'], 'remind', 'remind') | |
with tempfile.TemporaryDirectory(prefix='remind') as tmp_dir: | |
cmd = ["remind", f"\"-krem_save {tmp_dir} %s\"", rem_file, ">", "/dev/null"] | |
subprocess.check_call(" ".join(cmd), shell=True) | |
data['text'] = len(gb.glob(os.path.join(tmp_dir, '*'))) | |
cmd = ["/usr/bin/remind", rem_file] | |
rmind = subprocess.run(cmd, stdout=subprocess.PIPE) | |
data['tooltip'] = rmind.stdout.decode('utf8') | |
print(json.dumps(data)) |
Hello,
Can you replace the variable rem_file on line 10 with the path of your
remind file.
Exemple: rem_file = "/path/to/remindfile"
Have a nice day
Le dim. 16 avr. 2023, 00:12, Karol Machajewski ***@***.***> a
écrit :
… ***@***.**** commented on this gist.
------------------------------
I am getting
Traceback (most recent call last): File
"/home/tr4spy/.config/waybar/scripts/waybar-remind.py", line 10, in
<module> rem_file = os.path.join(os.environ['XDG_CONFIG_HOME'], 'remind',
'remind') File "/usr/lib/python3.10/os.py", line 680, in __getitem__ raise
KeyError(key) from None KeyError: 'XDG_CONFIG_HOME'
Even though I have XDG_CONFIG_HOME set up as one of the variables, any
ideas?
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/nicodebo/181f5135af9585e6f2c0fd05533b8004#gistcomment-4538167>
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AE32CU6GOM3HA5YUWDEJDZ3XBMMNHBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFQKSXMYLMOVS2I5DSOVS2I3TBNVS3W5DIOJSWCZC7OBQXE5DJMNUXAYLOORPWCY3UNF3GS5DZVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVEYTAOBTGA2DCNJUU52HE2LHM5SXFJTDOJSWC5DF>
.
You are receiving this email because you authored the thread.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reminders are displayed in the tooltip.