Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion bin/omarchy-reminder
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ clear_reminders() {

rm -f "$reminder_dir"/omarchy-reminder-*.message 2>/dev/null || true
omarchy-notification-send -g 󰔛 "All reminders have been cleared"
pkill -RTMIN+11 waybar 2>/dev/null || true
}

case ${1:-} in
Expand Down Expand Up @@ -131,6 +132,7 @@ if [[ -n $custom_message ]]; then
fi

systemd-run --user --quiet --collect --on-active="${minutes}m" --unit="$unit" \
bash -c 'omarchy-notification-send -g 󰔛 "Reminder" "$1" -u critical; rm -f "$2"' bash "$message" "$message_file"
bash -c 'omarchy-notification-send -g 󰔛 "Reminder" "$1" -u critical; rm -f "$2"; pkill -RTMIN+11 waybar 2>/dev/null' bash "$message" "$message_file"

omarchy-notification-send -g 󰔛 "$confirmation_title" "$confirmation"
pkill -RTMIN+11 waybar 2>/dev/null || true
10 changes: 9 additions & 1 deletion config/waybar/config.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"height": 26,
"width": 0,
"modules-left": ["custom/omarchy", "hyprland/workspaces"],
"modules-center": ["clock#horizontal", "clock#vertical", "custom/weather", "custom/update", "custom/voxtype", "custom/screenrecording-indicator", "custom/idle-indicator", "custom/notification-silencing-indicator"],
"modules-center": ["clock#horizontal", "clock#vertical", "custom/weather", "custom/update", "custom/voxtype", "custom/screenrecording-indicator", "custom/reminder-indicator", "custom/idle-indicator", "custom/notification-silencing-indicator"],
"modules-right": [
"group/tray-expander",
"bluetooth",
Expand Down Expand Up @@ -170,6 +170,14 @@
"signal": 8,
"return-type": "json"
},
"custom/reminder-indicator": {
"on-click": "omarchy-reminder show",
"on-click-right": "omarchy-reminder clear",
"exec": "$OMARCHY_PATH/default/waybar/indicators/reminders.sh",
"signal": 11,
"interval": 30,
"return-type": "json"
},
"custom/idle-indicator": {
"on-click": "omarchy-toggle-idle",
"exec": "$OMARCHY_PATH/default/waybar/indicators/idle.sh",
Expand Down
2 changes: 2 additions & 0 deletions config/waybar/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ tooltip {
}

#custom-screenrecording-indicator,
#custom-reminder-indicator,
#custom-idle-indicator,
#custom-notification-silencing-indicator {
min-width: 12px;
Expand Down Expand Up @@ -138,6 +139,7 @@ tooltip {
.left #custom-weather, .right #custom-weather { margin: 1.5px 0; padding: 6px 0; min-height: 12px; min-width: 14px; margin-right: 4px; }

.left #custom-screenrecording-indicator, .right #custom-screenrecording-indicator,
.left #custom-reminder-indicator, .right #custom-reminder-indicator,
.left #custom-idle-indicator, .right #custom-idle-indicator,
.left #custom-notification-silencing-indicator, .right #custom-notification-silencing-indicator {
margin: 5px 0 0 0;
Expand Down
45 changes: 45 additions & 0 deletions default/waybar/indicators/reminders.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

reminder_dir="${XDG_RUNTIME_DIR:-/tmp}/omarchy-reminders"
now=$(date +%s)
count=0
tooltip_lines=()

while IFS=$'\t' read -r timer next; do
[[ -z $timer || -z $next ]] && continue

next=$((next / 1000000))
((next <= now)) && continue

remaining=$((next - now))
minutes=$((remaining / 60))
reminder=${timer%.timer}
reminder=${reminder#omarchy-reminder-}
reminder_minutes=${reminder%%m-*}
reminder_message=""
[[ -f $reminder_dir/${timer%.timer}.message ]] && reminder_message=$(<"$reminder_dir/${timer%.timer}.message")

if [[ -n $reminder_message ]]; then
tooltip_lines+=("$reminder_message in ${minutes}m")
else
tooltip_lines+=("${reminder_minutes}m reminder in ${minutes}m")
fi

count=$((count + 1))
done < <(systemctl --user list-timers --all --output=json "omarchy-reminder-*.timer" 2>/dev/null | jq -r '.[] | [.unit, .next] | @tsv')

if ((count == 0)); then
echo '{"text": ""}'
else
tooltip=$(printf '%s\n' "${tooltip_lines[@]}")
Comment thread
jamespember marked this conversation as resolved.
tooltip=${tooltip%$'\n'}

if ((count == 1)); then
text=$(printf '\U000F009E')
else
text=$(printf '\U000F009E %d' "$count")
fi
Comment thread
jamespember marked this conversation as resolved.

jq -n --arg text "$text" --arg tooltip "$tooltip" \
'{"text": $text, "tooltip": $tooltip, "class": "active"}'
fi