Skip to content

Conversation

@ErikBjare
Copy link
Member

@ErikBjare ErikBjare commented Jan 23, 2025

Finally had enough of this not working on macOS.

Discovered terminal-notifier when looking for a CLI replacement to notify-send, works well!


Important

Adds terminal-notifier fallback for notifications on macOS in aw_notify/main.py.

  • Behavior:
    • Adds notify_terminal_notifier() function in aw_notify/main.py to send notifications using terminal-notifier on macOS.
    • Updates notify() function to use terminal-notifier as a fallback on macOS when DesktopNotifier fails.
    • Logs a warning if all notification methods fail.
  • Platform Specific:
    • Checks for sys.platform == "darwin" to determine if running on macOS.

This description was created by Ellipsis for ec71acf. It will automatically update as commits are pushed.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Reviewed everything up to 9531c1b in 58 seconds

More details
  • Looked at 79 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. aw_notify/main.py:177
  • Draft comment:
    Consider handling specific exceptions like FileNotFoundError for shutil.which and subprocess.CalledProcessError for subprocess.run to provide more precise error handling and logging.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The use of shutil.which is correct for checking the existence of terminal-notifier. However, the subprocess.run call should handle potential exceptions more gracefully, especially considering the use of check=True.
2. aw_notify/main.py:186
  • Draft comment:
    Be cautious with msg.strip("-").replace("- ", ", ").replace("\n", ""). This could unintentionally alter the message content. Consider documenting this behavior or ensuring it aligns with expected message formats.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The msg.strip("-").replace("- ", ", ").replace("\n", "") line is modifying the message string. This could potentially alter the intended message content, especially if the message legitimately contains these characters.

Workflow ID: wflow_qE3L9DgDS6sERouQ


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@ErikBjare ErikBjare force-pushed the dev/macos-terminal-notifier-fallback branch from 9531c1b to 11e6083 Compare January 23, 2025 10:20
Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Incremental review on 11e6083 in 35 seconds

More details
  • Looked at 77 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. aw_notify/main.py:184
  • Draft comment:
    Unnecessary use of strip("-") in msg.strip("-").replace("- ", ", ").replace("\n", ""). It could alter the message content unexpectedly. Consider removing it.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    Looking at the code, the strip("-") appears to be part of an intentional message formatting pipeline. The code is converting bullet points (like "- item1\n- item2") into a comma-separated list. The strip("-") removes any leading/trailing dashes, which makes sense as part of this transformation. Removing it could break the intended formatting.
    I could be wrong about the intended message format. Maybe there are cases where stripping dashes could remove important content.
    Looking at the code's usage (send_checkin function), messages are indeed formatted as bullet points with dashes. The strip("-") is a deliberate part of converting this format to a comma-separated list for terminal-notifier.
    The comment should be deleted. The strip("-") appears to be an intentional part of the message formatting pipeline, converting bullet points to comma-separated lists.

Workflow ID: wflow_8Qb2BP3YqniyFnX8


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@ErikBjare ErikBjare force-pushed the dev/macos-terminal-notifier-fallback branch from 11e6083 to ec71acf Compare January 23, 2025 10:27
Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Incremental review on ec71acf in 43 seconds

More details
  • Looked at 83 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. aw_notify/main.py:186
  • Draft comment:
    Using strip("-") will only remove leading and trailing hyphens, not all hyphens. Consider using replace("-", "") instead to remove all hyphens from the message.
                msg.replace("-", "").replace("- ", ", ").replace("\n", "")
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The current code appears intentional - it first strips leading/trailing hyphens, then replaces "- " with ", " to convert a bullet-point list into a comma-separated list. The comment's suggestion would remove ALL hyphens which could break hyphenated words. The current approach preserves hyphenated words while properly formatting bullet points.
    Maybe there are edge cases where having leading/trailing hyphens is actually desired in the notification message? The current code could potentially remove meaningful hyphens at the start/end.
    The code is formatting notification messages which are unlikely to need leading/trailing hyphens. The current approach sensibly preserves hyphenated words while cleaning up bullet-point formatting.
    The comment should be deleted. The current code's handling of hyphens appears intentional and correct for converting bullet-point lists to comma-separated lists while preserving hyphenated words.

Workflow ID: wflow_GM3XRyLtJeOCEdaS


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@ErikBjare ErikBjare merged commit fd4ed87 into master Jan 23, 2025
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants