Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dbus): fail if cannot be primary notification server #107

Merged
merged 2 commits into from
Aug 9, 2023

Conversation

kgilmer
Copy link
Contributor

@kgilmer kgilmer commented Aug 6, 2023

Addresses #87

Description

See #87 for details

Motivation and Context

Prevents the server from starting but doing nothing in the case that another service is primary for this D-Bus name

How Has This Been Tested?

Before change, running Regolith desktop on Ubuntu 23.04. By default the rofication demon holds the notification name in D-Bus:

$ cargo run
   Compiling runst v0.1.4 (/home/kgilmer/dev/repos/runst)
    Finished dev [unoptimized + debuginfo] target(s) in 3.20s
     Running `target/debug/runst`
2023-08-06T22:27:02.576823Z  INFO runst: starting

However runst does not show notifications with notify-send.

After change, program aborts:

$ cargo run
...
Running `target/debug/runst`
2023-08-06T22:18:40.543262Z  INFO runst: starting
thread '<unnamed>' panicked at 'failed to register D-Bus notification handler: InitializationError("Not primary D-Bus notification server, is another running?")', src/lib.rs:85:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Aborted (core dumped)

Additionally, killing the name holder, then running runst, results in showing notifications with notify-send. (Note: I shortened the name of the error type after running the above test)

Screenshots / Logs (if applicable)

unnecessary

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (no code change)
  • Refactor (refactoring production code)
  • Other

Checklist:

  • My code follows the code style of this project.
  • I have updated the documentation accordingly.
  • I have formatted the code with rustfmt.
  • I checked the lints with clippy.
  • [-] I have added tests to cover my changes.
    Unclear how a unit test could be added here without bigger changes
  • All new and existing tests passed.

@kgilmer kgilmer requested a review from orhun as a code owner August 6, 2023 22:31
@orhun orhun changed the title fix: fail if cannot be primary notification server on dbus fix(dbus): fail if cannot be primary notification server Aug 9, 2023
Copy link
Owner

@orhun orhun left a comment

Choose a reason for hiding this comment

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

This is great, thank you! 💖

@orhun orhun merged commit ed23396 into orhun:main Aug 9, 2023
2 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.

None yet

2 participants