Skip to content

Instantly share code, notes, and snippets.

@nicodebo

nicodebo/config Secret

Created March 6, 2021 16:45
Show Gist options
  • Save nicodebo/181f5135af9585e6f2c0fd05533b8004 to your computer and use it in GitHub Desktop.
Save nicodebo/181f5135af9585e6f2c0fd05533b8004 to your computer and use it in GitHub Desktop.
waybar, remind module example
"custom/remind": {
"format": "Rem: {}",
"tooltip": true,
"interval": 300,
"exec": "/path/to/waybar-remind.py",
"return-type": "json"
},
#custom-remind {
padding: 0 10px;
margin: 0 0px;
color: #ffffff;
background-color: #f0932b;
}
#!/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))
@nicodebo
Copy link
Author

nicodebo commented Mar 6, 2021

20210306_17h45m29s_grim

Reminders are displayed in the tooltip.

@nicodebo
Copy link
Author

nicodebo commented Apr 16, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment