Skip to content
Merged
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
12 changes: 9 additions & 3 deletions wavexlr/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ def _update_service_status(self):
self.audio_status_icon.set_from_icon_name("emblem-ok-symbolic")
self.audio_status_icon.remove_css_class("dim-label")
self.audio_status_row.set_subtitle("Audio service running")
self.uninstall_btn.set_visible(True)
else:
self.audio_status_icon.set_from_icon_name("dialog-warning-symbolic")
# Distinguish a service that never came up from one that is not
Expand All @@ -297,12 +296,19 @@ def _update_service_status(self):
else:
subtitle = "Audio service not running"
self.audio_status_row.set_subtitle(subtitle)
self.uninstall_btn.set_visible(False)

# Shown whenever there is something to remove, rather than only while
# the service runs. A stopped or failed service is when removing it
# matters most, and the udev rule and the config drop-ins outlive it
# either way.
self.uninstall_btn.set_visible(setup.anything_installed())

def _on_uninstall_clicked(self, btn):
dialog = Adw.AlertDialog(
heading="Uninstall Capture Fix?",
body="This will remove the audio service and USB permissions.\n\nYou can reinstall them by restarting OpenWave.",
body="This will remove the audio service, the WirePlumber rule, "
"the mix sinks and the USB permissions.\n\nYou can reinstall "
"them by restarting OpenWave.",
)
dialog.add_response("cancel", "Cancel")
dialog.add_response("uninstall", "Uninstall")
Expand Down
14 changes: 14 additions & 0 deletions wavexlr/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,20 @@ def needs_setup():
)


def anything_installed():
"""Whether any part of the integration is still on disk.

Not the inverse of needs_setup(): a partial install both needs setup and
has things left to remove.
"""
return (
udev_installed()
or service_installed()
or wireplumber_installed()
or mixes_installed()
)


def install_udev():
"""Install udev rules via pkexec."""
rules = "\n".join(UDEV_RULES)
Expand Down