Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package SwayAudioIdleInhibit for 
openSUSE:Factory checked in at 2026-09-21 12:20:23
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/SwayAudioIdleInhibit (Old)
 and      /work/SRC/openSUSE:Factory/.SwayAudioIdleInhibit.new.383539 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "SwayAudioIdleInhibit"

Mon Sep 21 12:20:23 2026 rev:2 rq:1379264 version:0.2.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/SwayAudioIdleInhibit/SwayAudioIdleInhibit.changes    
    2024-06-09 20:23:48.465260862 +0200
+++ 
/work/SRC/openSUSE:Factory/.SwayAudioIdleInhibit.new.383539/SwayAudioIdleInhibit.changes
    2026-09-21 12:20:25.121267290 +0200
@@ -1,0 +2,14 @@
+Wed Sep 16 20:26:31 UTC 2026 - Martin Pluskal <[email protected]>
+
+- Update to 0.2.0:
+  * Inhibit idle via systemd/elogind instead of the Wayland
+    idle-inhibit protocol; works with swayidle and hypridle
+  * Prevent crash when an audio device disconnects
+  * Fixes for PipeWire 0.3.77
+  * Add --ignore-source-outputs to skip named source outputs
+  * Document Waybar integration (--dry-print-both-waybar)
+- Switch BuildRequires to pkgconfig(libsystemd) and
+  pkgconfig(libpulse) >= 15.0; drop unused wayland-protocols,
+  wlroots and pipewire-devel
+
+-------------------------------------------------------------------

Old:
----
  SwayAudioIdleInhibit-0.1.1.tar.gz

New:
----
  SwayAudioIdleInhibit-0.2.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ SwayAudioIdleInhibit.spec ++++++
--- /var/tmp/diff_new_pack.R8SvAF/_old  2026-09-21 12:20:31.215522101 +0200
+++ /var/tmp/diff_new_pack.R8SvAF/_new  2026-09-21 12:20:31.217522184 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package SwayAudioIdleInhibit
 #
-# Copyright (c) 2024 SUSE LLC
+# Copyright (c) 2026 SUSE LLC and contributors
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -15,28 +15,28 @@
 # Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
+
 Name:           SwayAudioIdleInhibit
-Version:        0.1.1
+Version:        0.2.0
 Release:        0
 Summary:        Prevents swayidle from sleeping while outputting or receiving 
audio
 License:        GPL-3.0-or-later
 URL:            https://github.com/ErikReider/SwayAudioIdleInhibit
-Source0:        %{name}-%{version}.tar.gz
-BuildRequires:  meson
+Source0:        
%{url}/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
 BuildRequires:  gcc-c++
-BuildRequires:  pkgconfig(wayland-protocols)
-BuildRequires:  pkgconfig(wlroots)
-BuildRequires:  pkgconfig(libpulse)
-BuildRequires:  pipewire-devel
-BuildRequires:  systemd-devel
+BuildRequires:  meson
+BuildRequires:  pkgconfig
+BuildRequires:  pkgconfig(libpulse) >= 15.0
+BuildRequires:  pkgconfig(libsystemd)
 Requires:       pipewire-pulseaudio
 
 %description
-Prevents swayidle from sleeping while any application is outputting or 
receiving audio. Should work with all Wayland desktops that support the 
zwp_idle_inhibit_manager_v1 protocol but only tested in Sway
-This only works for Pulseaudio / Pipewire Pulse
+Prevents swayidle/hypridle from sleeping while any application is outputting
+or receiving audio. Uses systemd/elogind idle inhibit. Only works with
+PulseAudio / PipeWire Pulse.
 
 %prep
-%autosetup -a0 -p0
+%autosetup
 
 %build
 %meson

++++++ SwayAudioIdleInhibit-0.1.1.tar.gz -> SwayAudioIdleInhibit-0.2.0.tar.gz 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/SwayAudioIdleInhibit-0.1.1/.clang-format 
new/SwayAudioIdleInhibit-0.2.0/.clang-format
--- old/SwayAudioIdleInhibit-0.1.1/.clang-format        1970-01-01 
01:00:00.000000000 +0100
+++ new/SwayAudioIdleInhibit-0.2.0/.clang-format        2025-07-14 
22:41:01.000000000 +0200
@@ -0,0 +1,5 @@
+UseTab: Always
+IndentWidth: 4
+TabWidth: 4
+ColumnLimit: 80
+AllowShortFunctionsOnASingleLine: None
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/SwayAudioIdleInhibit-0.1.1/.editorconfig 
new/SwayAudioIdleInhibit-0.2.0/.editorconfig
--- old/SwayAudioIdleInhibit-0.1.1/.editorconfig        1970-01-01 
01:00:00.000000000 +0100
+++ new/SwayAudioIdleInhibit-0.2.0/.editorconfig        2025-07-14 
22:41:01.000000000 +0200
@@ -0,0 +1,10 @@
+root = true
+
+# Unix-style newlines with a newline ending every file
+[*]
+end_of_line = lf
+insert_final_newline = true
+
+[*.{h,c,hpp,cpp}]
+indent_style = tab
+indent_size = 4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/SwayAudioIdleInhibit-0.1.1/.gitignore 
new/SwayAudioIdleInhibit-0.2.0/.gitignore
--- old/SwayAudioIdleInhibit-0.1.1/.gitignore   2022-01-20 18:20:00.000000000 
+0100
+++ new/SwayAudioIdleInhibit-0.2.0/.gitignore   2025-07-14 22:41:01.000000000 
+0200
@@ -55,3 +55,5 @@
 SwayAudioIdleInhibit
 sway-audio-idle-inhibit-git*
 pkg
+
+!build-scripts/sway-audio-idle-inhibit-git.rpkg.spec
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/SwayAudioIdleInhibit-0.1.1/PKGBUILD 
new/SwayAudioIdleInhibit-0.2.0/PKGBUILD
--- old/SwayAudioIdleInhibit-0.1.1/PKGBUILD     2022-01-20 18:20:00.000000000 
+0100
+++ new/SwayAudioIdleInhibit-0.2.0/PKGBUILD     1970-01-01 01:00:00.000000000 
+0100
@@ -1,34 +0,0 @@
-# Maintainer: Erik Reider <[email protected]>
-pkgname=sway-audio-idle-inhibit-git
-pkgver=0.1
-pkgrel=1
-pkgdesc="Prevents swayidle from sleeping while any application is outputting 
or receiving audio"
-_pkgfoldername=SwayAudioIdleInhibit
-url="https://github.com/ErikReider/$_pkgfoldername";
-arch=(x86_64)
-license=(GPL)
-depends=("wayland>=1.14.91" "wayland-protocols" "libpulse")
-makedepends=(gcc meson git)
-optdepends=("swaync-git" "swaysettings-git")
-source=("git+$url")
-sha256sums=('SKIP')
-
-pkgver() {
-  cd $_pkgfoldername
-  printf "0.1.r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short 
HEAD)"
-}
-
-prepare() {
-  cd $_pkgfoldername
-  git checkout main
-  git pull
-}
-
-build() {
-  arch-meson $_pkgfoldername build
-  ninja -C build
-}
-
-package() {
-  DESTDIR="$pkgdir" meson install -C build
-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/SwayAudioIdleInhibit-0.1.1/README.md 
new/SwayAudioIdleInhibit-0.2.0/README.md
--- old/SwayAudioIdleInhibit-0.1.1/README.md    2022-01-20 18:20:00.000000000 
+0100
+++ new/SwayAudioIdleInhibit-0.2.0/README.md    2025-07-14 22:41:01.000000000 
+0200
@@ -1,8 +1,7 @@
 # SwayAudioIdleInhibit
 
-Prevents swayidle from sleeping while any application is outputting or
-receiving audio. Should work with all Wayland desktops that support the
-`zwp_idle_inhibit_manager_v1` protocol but only tested in Sway
+Prevents swayidle/hypridle from sleeping while any application is outputting or
+receiving audio. Requires systemd/elogind inhibit support.
 
 This only works for Pulseaudio / Pipewire Pulse
 
@@ -14,8 +13,13 @@
 Other:
 
 ```zsh
-meson build
-ninja -C build
+# Can compile to use systemd or elogind
+# systemd (default)
+meson setup build -Dlogind-provider=systemd
+# or elogind for systemd-less systems
+meson setup build -Dlogind-provider=elogind
+
+meson compile -C build
 meson install -C build
 ```
 
@@ -48,3 +52,29 @@
 ```zsh
 sway-audio-idle-inhibit --dry-print-sink
 ```
+
+## Waybar Integration
+
+A custom waybar module can be used to display an icon when any application is
+using your mic or playing any audio.
+
+Add the following section to your `~/.config/waybar/config` file and add
+`custom/audio_idle_inhibitor` to either the `modules-left`, `modules-center`
+or `modules-right` list.
+
+*Note: The FontAwesome font is used for the icons below*
+
+```json
+       "custom/audio_idle_inhibitor": {
+               "format": "{icon}",
+               "exec": "sway-audio-idle-inhibit --dry-print-both-waybar",
+               "exec-if": "which sway-audio-idle-inhibit",
+               "return-type": "json",
+               "format-icons": {
+                       "output": "",
+                       "input": "",
+                       "output-input": "  ",
+                       "none": ""
+               }
+       },
+```
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/SwayAudioIdleInhibit-0.1.1/build-scripts/PKGBUILD 
new/SwayAudioIdleInhibit-0.2.0/build-scripts/PKGBUILD
--- old/SwayAudioIdleInhibit-0.1.1/build-scripts/PKGBUILD       1970-01-01 
01:00:00.000000000 +0100
+++ new/SwayAudioIdleInhibit-0.2.0/build-scripts/PKGBUILD       2025-07-14 
22:41:01.000000000 +0200
@@ -0,0 +1,38 @@
+# Maintainer: Erik Reider <[email protected]>
+pkgname=sway-audio-idle-inhibit-git
+_ver=0.2.0
+pkgver=$_ver.r53.e903b34
+pkgrel=1
+pkgdesc="Prevents swayidle from sleeping while any application is outputting 
or receiving audio"
+_pkgfoldername=SwayAudioIdleInhibit
+url="https://github.com/ErikReider/$_pkgfoldername";
+arch=(
+    'x86_64'
+    'aarch64' # ARM v8 64-bit
+    'armv7h'  # ARM v7 hardfloat
+)
+license=(GPL)
+depends=("systemd-libs" "libpulse")
+makedepends=(gcc meson git)
+optdepends=("swaync-git" "swaysettings-git")
+source=("git+$url")
+sha256sums=('SKIP')
+
+pkgver() {
+  cd $_pkgfoldername
+  printf "$_ver.r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse 
--short HEAD)"
+}
+
+prepare() {
+  cd $_pkgfoldername
+  git checkout main
+}
+
+build() {
+  arch-meson $_pkgfoldername build
+  ninja -C build
+}
+
+package() {
+  DESTDIR="$pkgdir" meson install -C build
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/SwayAudioIdleInhibit-0.1.1/build-scripts/sway-audio-idle-inhibit-git.rpkg.spec
 
new/SwayAudioIdleInhibit-0.2.0/build-scripts/sway-audio-idle-inhibit-git.rpkg.spec
--- 
old/SwayAudioIdleInhibit-0.1.1/build-scripts/sway-audio-idle-inhibit-git.rpkg.spec
  1970-01-01 01:00:00.000000000 +0100
+++ 
new/SwayAudioIdleInhibit-0.2.0/build-scripts/sway-audio-idle-inhibit-git.rpkg.spec
  2025-07-14 22:41:01.000000000 +0200
@@ -0,0 +1,43 @@
+# vim: syntax=spec
+Name:       sway-audio-idle-inhibit-git
+Version:    {{{ git_repo_release lead="$(git describe --tags --abbrev=0)" }}}
+Release:    {{{ echo -n "$(git rev-list --all --count)" }}}%{?dist}
+Summary:    Prevents swayidle from sleeping while any application is 
outputting or receiving audio.
+License:    GPLv3
+URL:        https://github.com/ErikReider/SwayAudioIdleInhibit
+VCS:        {{{ git_repo_vcs }}}
+Source:     {{{ git_repo_pack }}}
+
+BuildRequires: meson >= 0.60.0
+BuildRequires: git
+BuildRequires: gcc-c++
+
+BuildRequires: pkgconfig(libpulse)
+BuildRequires: pkgconfig(libsystemd)
+
+%{?systemd_requires}
+
+%description
+Prevents swayidle from sleeping while any application is outputting or 
receiving audio.
+Should work with all Wayland desktops that support the 
zwp_idle_inhibit_manager_v1 protocol but only tested in Sway
+
+This only works for Pulseaudio / Pipewire Pulse
+
+%prep
+{{{ git_repo_setup_macro }}}
+
+%build
+%meson
+%meson_build
+
+%install
+%meson_install
+
+%files
+%doc README.md
+%{_bindir}/sway-audio-idle-inhibit
+%license LICENSE
+
+# Changelog will be empty until you make first annotated Git tag.
+%changelog
+{{{ git_repo_changelog }}}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/SwayAudioIdleInhibit-0.1.1/include/data.hpp 
new/SwayAudioIdleInhibit-0.2.0/include/data.hpp
--- old/SwayAudioIdleInhibit-0.1.1/include/data.hpp     2022-01-20 
18:20:00.000000000 +0100
+++ new/SwayAudioIdleInhibit-0.2.0/include/data.hpp     2025-07-14 
22:41:01.000000000 +0200
@@ -3,52 +3,55 @@
 #include <pulse/context.h>
 #include <pulse/thread-mainloop.h>
 
-#include <iostream>
-
 #include "idle.hpp"
 
 using namespace std;
 
+#define MAX_IGNORED_SOURCE_OUTPUTS 100
+
 enum SubscriptionType {
-  SUBSCRIPTION_TYPE_IDLE,
-  SUBSCRIPTION_TYPE_DRY_BOTH,
-  SUBSCRIPTION_TYPE_DRY_BOTH_WAYBAR,
-  SUBSCRIPTION_TYPE_DRY_SINK,
-  SUBSCRIPTION_TYPE_DRY_SOURCE,
+       SUBSCRIPTION_TYPE_IDLE,
+       SUBSCRIPTION_TYPE_DRY_BOTH,
+       SUBSCRIPTION_TYPE_DRY_BOTH_WAYBAR,
+       SUBSCRIPTION_TYPE_DRY_SINK,
+       SUBSCRIPTION_TYPE_DRY_SOURCE,
 };
 enum EventType {
-  EVENT_TYPE_IDLE,
-  EVENT_TYPE_DRY_BOTH,
-  EVENT_TYPE_DRY_SINK,
-  EVENT_TYPE_DRY_SOURCE,
-  EVENT_TYPE_NONE,
+       EVENT_TYPE_IDLE,
+       EVENT_TYPE_DRY_BOTH,
+       EVENT_TYPE_DRY_SINK,
+       EVENT_TYPE_DRY_SOURCE,
+       EVENT_TYPE_NONE,
 };
 
 struct Data {
-  pa_threaded_mainloop *mainloop;
-  pa_mainloop_api *mainloop_api;
-  pa_context *context;
+       pa_threaded_mainloop *mainloop;
+       pa_mainloop_api *mainloop_api;
+       pa_context *context;
+
+       EventType eventCalled = EVENT_TYPE_NONE;
+       bool activeSource = false;
+       bool activeSink = false;
 
-  EventType eventCalled = EVENT_TYPE_NONE;
-  bool activeSource = false;
-  bool activeSink = false;
+       SubscriptionType subscriptionType;
+       pa_subscription_mask_t pa_subscriptionType;
 
-  SubscriptionType subscriptionType;
-  pa_subscription_mask_t pa_subscriptionType;
+       char **ignoredSourceOutputs;
 
-  Idle *idle = NULL;
+       Idle *idle = NULL;
 
-  bool failed = false;
+       bool failed = false;
 
-  Data(pa_threaded_mainloop *mainloop, pa_mainloop_api *mainloop_api,
-       SubscriptionType subscriptionType,
-       pa_subscription_mask_t pa_subscriptionType, EventType eventType);
+       Data(pa_threaded_mainloop *mainloop, pa_mainloop_api *mainloop_api,
+                SubscriptionType subscriptionType,
+                pa_subscription_mask_t pa_subscriptionType, EventType 
eventType,
+                char **ignoredSourceOutputs);
 
-  void quit(int returnValue = 0);
+       void quit(int returnValue = 0);
 
-  void handleAction();
+       void handleAction();
 
- private:
-  void print(bool isRunning);
-  void printWayBar(bool activeSink, bool activeSource);
+  private:
+       void print(bool isRunning);
+       void printWayBar(bool activeSink, bool activeSource);
 };
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/SwayAudioIdleInhibit-0.1.1/include/idle.hpp 
new/SwayAudioIdleInhibit-0.2.0/include/idle.hpp
--- old/SwayAudioIdleInhibit-0.1.1/include/idle.hpp     2022-01-20 
18:20:00.000000000 +0100
+++ new/SwayAudioIdleInhibit-0.2.0/include/idle.hpp     2025-07-14 
22:41:01.000000000 +0200
@@ -1,23 +1,22 @@
 #pragma once
 
-#include "idle-inhibit-unstable-v1-client-protocol.h"
-
-using namespace std;
+#if HAVE_SYSTEMD
+#include <systemd/sd-bus.h>
+#include <systemd/sd-login.h>
+#elif HAVE_ELOGIND
+#include <elogind/sd-bus.h>
+#include <elogind/sd-login.h>
+#endif
 
 class Idle {
-  struct wl_compositor *compositor = NULL;
-  struct zwp_idle_inhibit_manager_v1 *wl_idle_inhibit_manager = NULL;
-  struct wl_surface *surface = NULL;
-  struct wl_display *display = NULL;
-  struct zwp_idle_inhibitor_v1 *idle = NULL;
-
-  static void global_add(void *data, struct wl_registry *registry,
-                         uint32_t name, const char *interface, uint32_t);
+       struct sd_bus *bus = nullptr;
+       int fd = -1;
 
-  static void global_remove(void *, struct wl_registry *, uint32_t);
+       void block();
+       void release_block();
 
- public:
-  Idle();
+  public:
+       Idle();
 
-  void update(bool isRunning);
+       void update(bool isRunning);
 };
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/SwayAudioIdleInhibit-0.1.1/include/pulse.hpp 
new/SwayAudioIdleInhibit-0.2.0/include/pulse.hpp
--- old/SwayAudioIdleInhibit-0.1.1/include/pulse.hpp    2022-01-20 
18:20:00.000000000 +0100
+++ new/SwayAudioIdleInhibit-0.2.0/include/pulse.hpp    2025-07-14 
22:41:01.000000000 +0200
@@ -5,44 +5,42 @@
 #include <pulse/mainloop-api.h>
 #include <pulse/pulseaudio.h>
 #include <pulse/thread-mainloop.h>
-#include <string.h>
-
-#include <cstdlib>
-#include <iostream>
 
 #include "data.hpp"
-#include "idle.hpp"
 
 class Pulse {
- public:
-  int init(SubscriptionType subscriptionType,
-           pa_subscription_mask_t pa_subscriptionType, EventType eventType);
+  public:
+       int init(SubscriptionType subscriptionType,
+                        pa_subscription_mask_t pa_subscriptionType, EventType 
eventType,
+                        char **ignoredSourceOutputs);
 
- private:
-  static void sink_input_info_callback(pa_context *,
-                                       const pa_sink_input_info *i, int,
-                                       void *userdata);
+  private:
+       static void sink_input_info_callback(pa_context *,
+                                                                               
 const pa_sink_input_info *i, int,
+                                                                               
 void *userdata);
 
-  static void source_output_info_callback(pa_context *,
-                                          const pa_source_output_info *i, int,
-                                          void *userdata);
+       static void source_output_info_callback(pa_context *,
+                                                                               
        const pa_source_output_info *i, int,
+                                                                               
        void *userdata);
 
-  void getRunning(EventType eventType, Data *data, pa_context *context);
+       void getRunning(EventType eventType, Data *data, pa_context *context);
 
-  static void subscribe_callback(pa_context *,
-                                 pa_subscription_event_type_t type, uint32_t,
-                                 void *userdata);
+       static void subscribe_callback(pa_context *,
+                                                                  
pa_subscription_event_type_t type, uint32_t,
+                                                                  void 
*userdata);
 
-  static void context_state_callback(pa_context *c, void *userdata);
+       static void context_state_callback(pa_context *c, void *userdata);
 
-  static pa_context *getContext(pa_threaded_mainloop *mainloop,
-                                pa_mainloop_api *mainloop_api, void *userdata);
+       static pa_context *getContext(pa_threaded_mainloop *mainloop,
+                                                                 
pa_mainloop_api *mainloop_api,
+                                                                 void 
*userdata);
 
-  void connect(pa_threaded_mainloop *mainloop, pa_mainloop_api *mainloop_api,
-               SubscriptionType subscriptionType,
-               pa_subscription_mask_t pa_subscriptionType, EventType 
eventType);
+       void connect(pa_threaded_mainloop *mainloop, pa_mainloop_api 
*mainloop_api,
+                                SubscriptionType subscriptionType,
+                                pa_subscription_mask_t pa_subscriptionType,
+                                EventType eventType, char 
**ignoredSourceOutputs);
 
-  pa_threaded_mainloop *getMainLoop();
+       pa_threaded_mainloop *getMainLoop();
 
-  pa_mainloop_api *getMainLoopApi(pa_threaded_mainloop *mainloop);
+       pa_mainloop_api *getMainLoopApi(pa_threaded_mainloop *mainloop);
 };
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/SwayAudioIdleInhibit-0.1.1/meson.build 
new/SwayAudioIdleInhibit-0.2.0/meson.build
--- old/SwayAudioIdleInhibit-0.1.1/meson.build  2022-01-20 18:20:00.000000000 
+0100
+++ new/SwayAudioIdleInhibit-0.2.0/meson.build  2025-07-14 22:41:01.000000000 
+0200
@@ -1,58 +1,53 @@
 project(
-  'SwayAudioIdleInhibit',
-  'c', 'cpp',
-  version: '0.1',
-  default_options: [],
+       'SwayAudioIdleInhibit',
+       'cpp',
+       version: '0.2.0',
+       default_options: [
+               'c_std=c11',
+               'cpp_std=c++11',
+               'warning_level=2',
+               'werror=true',
+       ],
+)
+
+add_project_arguments(
+       [
+               '-Wno-unused-parameter',
+               '-Wno-unused-result',
+               '-Wno-missing-braces',
+               '-Wno-format-zero-length',
+               '-Wno-missing-field-initializers',
+               '-Wundef',
+               '-Wvla',
+               '-Wlogical-op',
+               '-Wmissing-include-dirs',
+               '-Wpointer-arith',
+               '-Winit-self',
+               '-Wimplicit-fallthrough=2',
+               '-Wendif-labels',
+               '-Wstrict-aliasing=2',
+               '-Woverflow',
+               '-Walloca',
+       ],
+       language: 'cpp',
 )
 
-wayland_protos = dependency('wayland-protocols')
-wayland_client = dependency('wayland-client', version: '>=1.14.91')
+logind_dep = dependency('lib' + get_option('logind-provider'), required: true)
 
-wl_protocol_dir = wayland_protos.get_pkgconfig_variable('pkgdatadir')
-
-wayland_scanner = find_program('wayland-scanner')
-wayland_scanner_code = generator(
-  wayland_scanner,
-  output: '@[email protected]',
-  arguments: ['private-code', '@INPUT@', '@OUTPUT@'],
-)
-wayland_scanner_client = generator(
-  wayland_scanner,
-  output: '@[email protected]',
-  arguments: ['client-header', '@INPUT@', '@OUTPUT@'],
-)
-
-xml = join_paths([wl_protocol_dir, 
'unstable/idle-inhibit/idle-inhibit-unstable-v1.xml'])
-client_protos_src = wayland_scanner_code.process(xml)
-client_protos_headers = wayland_scanner_client.process(xml)
-
-lib_client_protos = static_library(
-  'client_protos',
-  [ client_protos_src, client_protos_headers ],
-  dependencies: [ wayland_client ],
-)
-
-client_protos = declare_dependency(
-  link_with: lib_client_protos,
-  sources: client_protos_headers,
-)
+add_project_arguments('-D', 'HAVE_' + 
get_option('logind-provider').to_upper(), language: 'cpp')
 
 executable(
-  'sway-audio-idle-inhibit',
-  [
-    './src/main.cpp',
-    './src/data.cpp',
-    './src/pulse.cpp',
-    './src/idle.cpp',
-  ],
-  include_directories: [
-    include_directories('include')
-  ],
-  dependencies: [
-    dependency('libpulse', version: '>= 15.0'),
-    wayland_protos,
-    wayland_client,
-    client_protos,
-  ],
-  install: true,
+       'sway-audio-idle-inhibit',
+       files(
+               './src/data.cpp',
+               './src/idle.cpp',
+               './src/main.cpp',
+               './src/pulse.cpp',
+       ),
+       include_directories: include_directories('include'),
+       dependencies: [
+               dependency('libpulse', version: '>= 15.0'),
+               logind_dep,
+       ],
+       install: true,
 )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/SwayAudioIdleInhibit-0.1.1/meson_options.txt 
new/SwayAudioIdleInhibit-0.2.0/meson_options.txt
--- old/SwayAudioIdleInhibit-0.1.1/meson_options.txt    1970-01-01 
01:00:00.000000000 +0100
+++ new/SwayAudioIdleInhibit-0.2.0/meson_options.txt    2025-07-14 
22:41:01.000000000 +0200
@@ -0,0 +1 @@
+option('logind-provider', type: 'combo', choices: ['systemd', 'elogind'], 
value: 'systemd', description: 'Provider of logind support library')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/SwayAudioIdleInhibit-0.1.1/src/data.cpp 
new/SwayAudioIdleInhibit-0.2.0/src/data.cpp
--- old/SwayAudioIdleInhibit-0.1.1/src/data.cpp 2022-01-20 18:20:00.000000000 
+0100
+++ new/SwayAudioIdleInhibit-0.2.0/src/data.cpp 2025-07-14 22:41:01.000000000 
+0200
@@ -1,57 +1,67 @@
+#include <iostream>
+#include <string>
+
 #include "data.hpp"
 
 Data::Data(pa_threaded_mainloop *mainloop, pa_mainloop_api *mainloop_api,
-           SubscriptionType subscriptionType,
-           pa_subscription_mask_t pa_subscriptionType, EventType eventType) {
-  this->mainloop = mainloop;
-  this->mainloop_api = mainloop_api;
-  this->subscriptionType = subscriptionType;
-  this->pa_subscriptionType = pa_subscriptionType;
-  this->eventCalled = eventType;
+                  SubscriptionType subscriptionType,
+                  pa_subscription_mask_t pa_subscriptionType, EventType 
eventType,
+                  char **ignoredSourceOutputs) {
+       this->mainloop = mainloop;
+       this->mainloop_api = mainloop_api;
+       this->subscriptionType = subscriptionType;
+       this->pa_subscriptionType = pa_subscriptionType;
+       this->eventCalled = eventType;
+       this->ignoredSourceOutputs = ignoredSourceOutputs;
 
-  if (subscriptionType == SUBSCRIPTION_TYPE_IDLE) idle = new Idle();
+       if (subscriptionType == SUBSCRIPTION_TYPE_IDLE)
+               idle = new Idle();
 }
 
 void Data::quit(int returnValue) {
-  mainloop_api->quit(mainloop_api, returnValue);
-  pa_threaded_mainloop_stop(mainloop);
-  pa_threaded_mainloop_free(mainloop);
+       mainloop_api->quit(mainloop_api, returnValue);
+       pa_threaded_mainloop_stop(mainloop);
+       pa_threaded_mainloop_free(mainloop);
 }
 
 void Data::handleAction() {
-  switch (subscriptionType) {
-    case SUBSCRIPTION_TYPE_IDLE:
-      idle->update(activeSink || activeSource);
-      break;
-    case SUBSCRIPTION_TYPE_DRY_BOTH:
-      this->print(activeSink || activeSource);
-      break;
-    case SUBSCRIPTION_TYPE_DRY_BOTH_WAYBAR:
-      this->printWayBar(activeSink, activeSource);
-      break;
-    case SUBSCRIPTION_TYPE_DRY_SINK:
-      this->print(activeSink);
-      break;
-    case SUBSCRIPTION_TYPE_DRY_SOURCE:
-      this->print(activeSource);
-      break;
-  }
+       switch (subscriptionType) {
+       case SUBSCRIPTION_TYPE_IDLE:
+               idle->update(activeSink || activeSource);
+               break;
+       case SUBSCRIPTION_TYPE_DRY_BOTH:
+               this->print(activeSink || activeSource);
+               break;
+       case SUBSCRIPTION_TYPE_DRY_BOTH_WAYBAR:
+               this->printWayBar(activeSink, activeSource);
+               break;
+       case SUBSCRIPTION_TYPE_DRY_SINK:
+               this->print(activeSink);
+               break;
+       case SUBSCRIPTION_TYPE_DRY_SOURCE:
+               this->print(activeSource);
+               break;
+       }
 }
 
 void Data::print(bool isRunning) {
-  cout << (isRunning ? "RUNNING" : "NOT RUNNING") << endl;
+       cout << (isRunning ? "RUNNING" : "NOT RUNNING") << endl;
 }
 
 void Data::printWayBar(bool activeSink, bool activeSource) {
-  string result[2] = {activeSink ? "output" : "", activeSource ? "input" : ""};
-  string text = "";
-  for (const auto &str : result) {
-    if (!text.empty() && !str.empty()) text += "-";
-    text += str;
-  }
-  if (text.empty()) text = "none";
-  cout << "{\"text\": \"\", \"alt\": \"" + text +
-              "\", \"tooltip\": \"\", \"class\": "
-              "\"" +
-              text + "\"}" << endl;
+       string result[2] = {activeSink ? "output" : "",
+                                               activeSource ? "input" : ""};
+       string text = "";
+       for (const auto &str : result) {
+               if (!text.empty() && !str.empty())
+                       text += "-";
+               text += str;
+       }
+       if (text.empty())
+               text = "none";
+       cout << "{\"text\": \"\", \"alt\": \"" + text +
+                               "\", \"tooltip\": \"\", \"class\": "
+                               "\"" +
+                               text + "\"}"
+                << endl;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/SwayAudioIdleInhibit-0.1.1/src/idle.cpp 
new/SwayAudioIdleInhibit-0.2.0/src/idle.cpp
--- old/SwayAudioIdleInhibit-0.1.1/src/idle.cpp 2022-01-20 18:20:00.000000000 
+0100
+++ new/SwayAudioIdleInhibit-0.2.0/src/idle.cpp 2025-07-14 22:41:01.000000000 
+0200
@@ -1,69 +1,72 @@
+#include <cassert>
+#include <cstdio>
+#include <fcntl.h>
+#include <iostream>
+#include <unistd.h>
+
 #include "idle.hpp"
 
-#include <string.h>
+using namespace std;
 
-#include <iostream>
+void Idle::block() {
+       assert(bus);
 
-using namespace std;
+       // Skip if already inhibiting
+       if (fd >= 0) {
+               return;
+       }
+
+       sd_bus_message *message = nullptr;
+       sd_bus_error error = SD_BUS_ERROR_NULL;
+       int ret = sd_bus_call_method(
+               bus, "org.freedesktop.login1", "/org/freedesktop/login1",
+               "org.freedesktop.login1.Manager", "Inhibit", &error, &message, 
"ssss",
+               "idle", "sway-audio-idle-inhibit", "Audio is playing", "block");
+       if (ret < 0) {
+               fprintf(stderr, "Could not send inhibit signal!\n");
+               abort();
+       }
+
+       ret = sd_bus_message_read(message, "h", &fd);
+       if (ret < 0) {
+               errno = -ret;
+               fprintf(stderr, "Could not get DBus response\n");
+               abort();
+       }
+
+       // Clone the FD (will be invalid once we unref the message)
+       fd = fcntl(fd, F_DUPFD_CLOEXEC, 3);
+       if (fd >= 0) {
+       } else {
+               fprintf(stderr, "Could not copy lock fd\n");
+       }
 
-void Idle::global_add(void *data, struct wl_registry *registry, uint32_t name,
-                      const char *interface, uint32_t) {
-  Idle *idle = (Idle *)data;
-  if (strcmp(interface, wl_compositor_interface.name) == 0) {
-    idle->compositor = (wl_compositor *)wl_registry_bind(
-        registry, name, &wl_compositor_interface, 1);
-  } else if (strcmp(interface, zwp_idle_inhibit_manager_v1_interface.name) ==
-             0) {
-    idle->wl_idle_inhibit_manager =
-        (zwp_idle_inhibit_manager_v1 *)wl_registry_bind(
-            registry, name, &zwp_idle_inhibit_manager_v1_interface, 1);
-  }
+       sd_bus_error_free(&error);
+       sd_bus_message_unref(message);
 }
 
-void Idle::global_remove(void *, struct wl_registry *, uint32_t) {}
+void Idle::release_block() {
+       if (fd >= 0) {
+               close(fd);
+               fd = -1;
+       }
+}
 
 Idle::Idle() {
-  display = wl_display_connect(NULL);
-  if (display == NULL) {
-    fprintf(stderr, "failed to connect to wl_display\n");
-    exit(1);
-  }
-
-  const struct wl_registry_listener registry_listener = {
-      .global = global_add,
-      .global_remove = global_remove,
-  };
-
-  struct wl_registry *registry = wl_display_get_registry(display);
-  wl_registry_add_listener(registry, &registry_listener, this);
-  wl_display_roundtrip(display);
-
-  if (wl_idle_inhibit_manager == NULL) {
-    fprintf(stderr, "wl_idle_inhibit_manager is NULL\n");
-    exit(1);
-  }
-  if (compositor == NULL) {
-    fprintf(stderr, "compositor is NULL\n");
-    exit(1);
-  }
-
-  surface = wl_compositor_create_surface(compositor);
+       // Connect to DBus
+       int ret = sd_bus_default_system(&bus);
+       if (ret < 0) {
+               fprintf(stderr, "Failed to get DBus connection\n");
+               abort();
+       }
 }
 
 void Idle::update(bool isRunning) {
-  if (isRunning) {
-    if (idle == NULL) {
-      idle = zwp_idle_inhibit_manager_v1_create_inhibitor(
-          wl_idle_inhibit_manager, surface);
-      wl_display_roundtrip(display);
-    }
-    cout << "IDLE INHIBITED" << endl;
-  } else {
-    if (idle != NULL) {
-      zwp_idle_inhibitor_v1_destroy(idle);
-      idle = NULL;
-      wl_display_roundtrip(display);
-    }
-    cout << "NOT IDLE INHIBITED" << endl;
-  }
+       if (isRunning) {
+               block();
+               cout << "IDLE INHIBITED" << endl;
+       } else {
+               release_block();
+               cout << "NOT IDLE INHIBITED" << endl;
+       }
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/SwayAudioIdleInhibit-0.1.1/src/main.cpp 
new/SwayAudioIdleInhibit-0.2.0/src/main.cpp
--- old/SwayAudioIdleInhibit-0.1.1/src/main.cpp 2022-01-20 18:20:00.000000000 
+0100
+++ new/SwayAudioIdleInhibit-0.2.0/src/main.cpp 2025-07-14 22:41:01.000000000 
+0200
@@ -1,67 +1,90 @@
-#include <libgen.h>
 #include <cstring>
+#include <iostream>
+#include <libgen.h>
+#include <string>
 
 #include "data.hpp"
 #include "pulse.hpp"
 
 void showHelp(char **argv) {
-  string name = basename(argv[0]);
-  cout << "Usage:\n";
-  cout << "\t" << name << " <OPTION>\n";
-  cout << "Options:\n";
-  cout << "\t " << name
-       << "\t Inhibits idle if either any sink or any source is running\n";
-  cout << "\t -h, --help \t\t\t Show help options\n";
-  cout << "\t --dry-print-both \t\t Don't inhibit idle and print if either any 
"
-          "sink or any source is running\n";
-  cout << "\t --dry-print-both-waybar \t Same as --dry-print-both but outputs "
-          "in a waybar friendly manner\n";
-  cout << "\t --dry-print-sink \t\t Don't inhibit idle and print if any "
-          "sink is running\n";
-  cout << "\t --dry-print-source \t\t Don't inhibit idle and print if any "
-          "source is running\n";
+       string name = basename(argv[0]);
+       cout << "Usage:\n";
+       cout << "\t" << name << " <OPTION>\n";
+       cout << "Options:\n";
+       cout << "\t " << name
+                << "\t Inhibits idle if either any sink or any source is 
running\n";
+       cout << "\t -h, --help \t\t\t Show help options\n";
+       cout << "\t --dry-print-both \t\t Don't inhibit idle and print if 
either "
+                       "any "
+                       "sink or any source is running\n";
+       cout
+               << "\t --dry-print-both-waybar \t Same as --dry-print-both but 
outputs "
+                  "in a waybar friendly manner\n";
+       cout << "\t --dry-print-sink \t\t Don't inhibit idle and print if any "
+                       "sink is running\n";
+       cout << "\t --dry-print-source \t\t Don't inhibit idle and print if any 
"
+                       "source is running\n";
+       cout << "\t --ignore-source-outputs \t\t Don't inhibit idle for these "
+                       "source outputs\n";
 }
 
 int main(int argc, char *argv[]) {
-  bool printBoth = false;
-  bool printBothWayBar = false;
-  bool printSource = false;
-  bool printSink = false;
-
-  if (argc > 1) {
-    for (int i = 1; i < argc; i++) {
-      if (strcmp(argv[i], "--dry-print-source") == 0) {
-        printSource = true;
-      } else if (strcmp(argv[i], "--dry-print-sink") == 0) {
-        printSink = true;
-      } else if (strcmp(argv[i], "--dry-print-both") == 0) {
-        printBoth = true;
-      } else if (strcmp(argv[i], "--dry-print-both-waybar") == 0) {
-        printBothWayBar = true;
-      } else {
-        showHelp(argv);
-        return 0;
-      }
-    }
-  }
-
-  pa_subscription_mask_t all_mask =
-      (pa_subscription_mask_t)(PA_SUBSCRIPTION_MASK_SINK |
-                               PA_SUBSCRIPTION_MASK_SOURCE);
-  if (!printSink && !printSource && !printBoth && !printBothWayBar) {
-    return Pulse().init(SUBSCRIPTION_TYPE_IDLE, all_mask, EVENT_TYPE_IDLE);
-  } else if (printBoth) {
-    return Pulse().init(SUBSCRIPTION_TYPE_DRY_BOTH, all_mask,
-                        EVENT_TYPE_DRY_BOTH);
-  } else if (printBothWayBar) {
-    return Pulse().init(SUBSCRIPTION_TYPE_DRY_BOTH_WAYBAR, all_mask,
-                        EVENT_TYPE_DRY_BOTH);
-  } else if (printSink) {
-    return Pulse().init(SUBSCRIPTION_TYPE_DRY_SINK, PA_SUBSCRIPTION_MASK_SINK,
-                        EVENT_TYPE_DRY_SINK);
-  } else if (printSource) {
-    return Pulse().init(SUBSCRIPTION_TYPE_DRY_SOURCE,
-                        PA_SUBSCRIPTION_MASK_SOURCE, EVENT_TYPE_DRY_SOURCE);
-  }
-  return 0;
+       bool printBoth = false;
+       bool printBothWayBar = false;
+       bool printSource = false;
+       bool printSink = false;
+
+       char *ignoredSourceOutputs[MAX_IGNORED_SOURCE_OUTPUTS] = {nullptr};
+       int ignoredSourceOutputsCount = 0;
+
+       if (argc > 1) {
+               for (int i = 1; i < argc; i++) {
+                       if (strcmp(argv[i], "--dry-print-source") == 0) {
+                               printSource = true;
+                       } else if (strcmp(argv[i], "--dry-print-sink") == 0) {
+                               printSink = true;
+                       } else if (strcmp(argv[i], "--dry-print-both") == 0) {
+                               printBoth = true;
+                       } else if (strcmp(argv[i], "--dry-print-both-waybar") 
== 0) {
+                               printBothWayBar = true;
+                       } else if (strcmp(argv[i], "--ignore-source-outputs") 
== 0 &&
+                                          i + 1 < argc) {
+                               char *saveptr;
+                               char *token = strtok_r(argv[++i], " ", 
&saveptr);
+                               while (token != nullptr &&
+                                          ignoredSourceOutputsCount < 
MAX_IGNORED_SOURCE_OUTPUTS) {
+                                       
ignoredSourceOutputs[ignoredSourceOutputsCount++] = token;
+                                       token = strtok_r(nullptr, " ", 
&saveptr);
+                               }
+
+                               ignoredSourceOutputs[ignoredSourceOutputsCount] 
= nullptr;
+                       } else {
+                               showHelp(argv);
+                               return 0;
+                       }
+               }
+       }
+
+       pa_subscription_mask_t all_mask =
+               (pa_subscription_mask_t)(PA_SUBSCRIPTION_MASK_SINK_INPUT |
+                                                                
PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT);
+       if (!printSink && !printSource && !printBoth && !printBothWayBar) {
+               return Pulse().init(SUBSCRIPTION_TYPE_IDLE, all_mask, 
EVENT_TYPE_IDLE,
+                                                       ignoredSourceOutputs);
+       } else if (printBoth) {
+               return Pulse().init(SUBSCRIPTION_TYPE_DRY_BOTH, all_mask,
+                                                       EVENT_TYPE_DRY_BOTH, 
ignoredSourceOutputs);
+       } else if (printBothWayBar) {
+               return Pulse().init(SUBSCRIPTION_TYPE_DRY_BOTH_WAYBAR, all_mask,
+                                                       EVENT_TYPE_DRY_BOTH, 
ignoredSourceOutputs);
+       } else if (printSink) {
+               return Pulse().init(SUBSCRIPTION_TYPE_DRY_SINK,
+                                                       
PA_SUBSCRIPTION_MASK_SINK_INPUT,
+                                                       EVENT_TYPE_DRY_SINK, 
ignoredSourceOutputs);
+       } else if (printSource) {
+               return Pulse().init(SUBSCRIPTION_TYPE_DRY_SOURCE,
+                                                       
PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT,
+                                                       EVENT_TYPE_DRY_SOURCE, 
ignoredSourceOutputs);
+       }
+       return 0;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/SwayAudioIdleInhibit-0.1.1/src/pulse.cpp 
new/SwayAudioIdleInhibit-0.2.0/src/pulse.cpp
--- old/SwayAudioIdleInhibit-0.1.1/src/pulse.cpp        2022-01-20 
18:20:00.000000000 +0100
+++ new/SwayAudioIdleInhibit-0.2.0/src/pulse.cpp        2025-07-14 
22:41:01.000000000 +0200
@@ -1,214 +1,234 @@
-#include "pulse.hpp"
-
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
 #include <pulse/context.h>
 #include <pulse/def.h>
 #include <pulse/mainloop-api.h>
+#include <pulse/proplist.h>
 #include <pulse/pulseaudio.h>
 #include <pulse/thread-mainloop.h>
 #include <string.h>
 
-#include <cstdlib>
-#include <iostream>
-
 #include "data.hpp"
+#include "pulse.hpp"
 
 int Pulse::init(SubscriptionType subscriptionType,
-                pa_subscription_mask_t pa_subscriptionType,
-                EventType eventType) {
-  pa_threaded_mainloop *mainloop = getMainLoop();
-  pa_mainloop_api *mainloop_api = getMainLoopApi(mainloop);
-  if (pa_threaded_mainloop_start(mainloop)) {
-    fprintf(stderr, "pa_threaded_mainloop_start() failed.\n");
-    return 1;
-  }
-  connect(mainloop, mainloop_api, subscriptionType, pa_subscriptionType,
-          eventType);
-  return 0;
+                               pa_subscription_mask_t pa_subscriptionType, 
EventType eventType,
+                               char **ignoredSourceOutputs) {
+       pa_threaded_mainloop *mainloop = getMainLoop();
+       pa_mainloop_api *mainloop_api = getMainLoopApi(mainloop);
+       if (pa_threaded_mainloop_start(mainloop)) {
+               fprintf(stderr, "pa_threaded_mainloop_start() failed.\n");
+               return 1;
+       }
+       connect(mainloop, mainloop_api, subscriptionType, pa_subscriptionType,
+                       eventType, ignoredSourceOutputs);
+       return 0;
 }
 
 void Pulse::sink_input_info_callback(pa_context *, const pa_sink_input_info *i,
-                                     int, void *userdata) {
-  Data *data = (Data *)userdata;
-  if (i && !i->corked) data->activeSink = true;
-  pa_threaded_mainloop_signal(data->mainloop, 0);
+                                                                        int, 
void *userdata) {
+       Data *data = (Data *)userdata;
+       if (i && !i->corked && i->client != PA_INVALID_INDEX)
+               data->activeSink = true;
+       pa_threaded_mainloop_signal(data->mainloop, 0);
 }
 
 void Pulse::source_output_info_callback(pa_context *,
-                                        const pa_source_output_info *i, int,
-                                        void *userdata) {
-  Data *data = (Data *)userdata;
-  if (i && !i->corked) data->activeSource = true;
-  pa_threaded_mainloop_signal(data->mainloop, 0);
+                                                                               
const pa_source_output_info *i, int,
+                                                                               
void *userdata) {
+       Data *data = (Data *)userdata;
+       bool ignoreSourceOutput = false;
+       if (i && i->proplist) {
+               const char *appName = pa_proplist_gets(i->proplist, 
"application.name");
+               if (appName) {
+                       int ignoredSourceOutputsCount = 0;
+                       while 
(data->ignoredSourceOutputs[ignoredSourceOutputsCount] !=
+                                          nullptr &&
+                                  ignoreSourceOutput == false &&
+                                  ignoredSourceOutputsCount < 
MAX_IGNORED_SOURCE_OUTPUTS) {
+                               if (strcmp(appName, data->ignoredSourceOutputs
+                                                                               
[ignoredSourceOutputsCount]) == 0) {
+                                       ignoreSourceOutput = true;
+                                       break;
+                               }
+                               ignoredSourceOutputsCount++;
+                       }
+               }
+       }
+       if (i && !i->corked && i->client != PA_INVALID_INDEX && 
!ignoreSourceOutput)
+               data->activeSource = true;
+       pa_threaded_mainloop_signal(data->mainloop, 0);
 }
 
 void Pulse::getRunning(EventType eventType, Data *data, pa_context *context) {
-  pa_threaded_mainloop_lock(data->mainloop);
-  pa_operation *op = NULL;
-  switch (eventType) {
-    case EVENT_TYPE_DRY_SINK:
-      data->activeSink = false;
-      op = pa_context_get_sink_input_info_list(context,
-                                               sink_input_info_callback, data);
-      break;
-    case EVENT_TYPE_DRY_SOURCE:
-      data->activeSource = false;
-      op = pa_context_get_source_output_info_list(
-          context, source_output_info_callback, data);
-      break;
-    default:
-      fprintf(stderr, "Operation Default!\n");
-      pa_threaded_mainloop_unlock(data->mainloop);
-      return;
-  }
-  if (!op) {
-    pa_threaded_mainloop_unlock(data->mainloop);
-    fprintf(stderr, "Operation failed!\n");
-    return;
-  }
-  while (pa_operation_get_state(op) == PA_OPERATION_RUNNING) {
-    pa_threaded_mainloop_wait(data->mainloop);
-  }
-  pa_operation_unref(op);
-  pa_threaded_mainloop_unlock(data->mainloop);
+       pa_threaded_mainloop_lock(data->mainloop);
+       pa_operation *op = NULL;
+       switch (eventType) {
+       case EVENT_TYPE_DRY_SINK:
+               data->activeSink = false;
+               op = pa_context_get_sink_input_info_list(
+                       context, sink_input_info_callback, data);
+               break;
+       case EVENT_TYPE_DRY_SOURCE:
+               data->activeSource = false;
+               op = pa_context_get_source_output_info_list(
+                       context, source_output_info_callback, data);
+               break;
+       default:
+               fprintf(stderr, "Operation Default!\n");
+               pa_threaded_mainloop_unlock(data->mainloop);
+               return;
+       }
+       if (!op) {
+               pa_threaded_mainloop_unlock(data->mainloop);
+               fprintf(stderr, "Operation failed!\n");
+               return;
+       }
+       while (pa_operation_get_state(op) == PA_OPERATION_RUNNING) {
+               pa_threaded_mainloop_wait(data->mainloop);
+       }
+       pa_operation_unref(op);
+       pa_threaded_mainloop_unlock(data->mainloop);
 }
 
 void Pulse::subscribe_callback(pa_context *, pa_subscription_event_type_t type,
-                               uint32_t, void *userdata) {
-  Data *data = (Data *)userdata;
-  EventType eventType;
-  switch (type & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) {
-    case PA_SUBSCRIPTION_EVENT_SINK:
-      eventType = EVENT_TYPE_DRY_SINK;
-      break;
-    case PA_SUBSCRIPTION_EVENT_SOURCE:
-      eventType = EVENT_TYPE_DRY_SOURCE;
-      break;
-    default:
-      return;
-  }
-  if (data->subscriptionType == SUBSCRIPTION_TYPE_IDLE) {
-    eventType = EVENT_TYPE_IDLE;
-  } else if (data->subscriptionType == SUBSCRIPTION_TYPE_DRY_BOTH ||
-             data->subscriptionType == SUBSCRIPTION_TYPE_DRY_BOTH_WAYBAR) {
-    eventType = EVENT_TYPE_DRY_BOTH;
-  }
-  data->eventCalled = eventType;
-  pa_threaded_mainloop_signal(data->mainloop, 0);
+                                                          uint32_t, void 
*userdata) {
+       Data *data = (Data *)userdata;
+       EventType eventType;
+       switch (type & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) {
+       case PA_SUBSCRIPTION_EVENT_SINK_INPUT:
+               eventType = EVENT_TYPE_DRY_SINK;
+               break;
+       case PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT:
+               eventType = EVENT_TYPE_DRY_SOURCE;
+               break;
+       default:
+               return;
+       }
+       if (data->subscriptionType == SUBSCRIPTION_TYPE_IDLE) {
+               eventType = EVENT_TYPE_IDLE;
+       } else if (data->subscriptionType == SUBSCRIPTION_TYPE_DRY_BOTH ||
+                          data->subscriptionType == 
SUBSCRIPTION_TYPE_DRY_BOTH_WAYBAR) {
+               eventType = EVENT_TYPE_DRY_BOTH;
+       }
+       data->eventCalled = eventType;
+       pa_threaded_mainloop_signal(data->mainloop, 0);
 }
 
 void Pulse::context_state_callback(pa_context *c, void *userdata) {
-  Data *data = (Data *)userdata;
-  switch (pa_context_get_state(c)) {
-    case PA_CONTEXT_CONNECTING:
-    case PA_CONTEXT_AUTHORIZING:
-    case PA_CONTEXT_SETTING_NAME:
-      break;
-    case PA_CONTEXT_READY:
-      pa_threaded_mainloop_signal(data->mainloop, 0);
-      break;
-    case PA_CONTEXT_TERMINATED:
-    case PA_CONTEXT_FAILED:
-      fprintf(stderr, "PulseAudio connection lost. Will retry connection.\n");
-      data->failed = true;
-      pa_threaded_mainloop_signal(data->mainloop, 0);
-      break;
-    default:
-      fprintf(stderr, "Connection failure: %s\n",
-              pa_strerror(pa_context_errno(c)));
-      data->quit(1);
-      exit(1);
-      break;
-  }
+       Data *data = (Data *)userdata;
+       switch (pa_context_get_state(c)) {
+       case PA_CONTEXT_CONNECTING:
+       case PA_CONTEXT_AUTHORIZING:
+       case PA_CONTEXT_SETTING_NAME:
+               break;
+       case PA_CONTEXT_READY:
+               pa_threaded_mainloop_signal(data->mainloop, 0);
+               break;
+       case PA_CONTEXT_TERMINATED:
+       case PA_CONTEXT_FAILED:
+               fprintf(stderr, "PulseAudio connection lost. Will retry 
connection.\n");
+               data->failed = true;
+               pa_threaded_mainloop_signal(data->mainloop, 0);
+               break;
+       default:
+               fprintf(stderr, "Connection failure: %s\n",
+                               pa_strerror(pa_context_errno(c)));
+               data->quit(1);
+               exit(1);
+               break;
+       }
 }
 
 pa_context *Pulse::getContext(pa_threaded_mainloop *mainloop,
-                              pa_mainloop_api *mainloop_api, void *userdata) {
-  Data *data = (Data *)userdata;
+                                                         pa_mainloop_api 
*mainloop_api, void *userdata) {
+       Data *data = (Data *)userdata;
 
-  pa_context *context = pa_context_new(mainloop_api, "PulseAudio Test");
-  if (!context) {
-    fprintf(stderr, "pa_context_new() failed\n");
-    exit(1);
-  }
-
-  pa_threaded_mainloop_lock(mainloop);
-  if (pa_context_connect(context, NULL, PA_CONTEXT_NOAUTOSPAWN, NULL) < 0) {
-    fprintf(stderr, "pa_context_connect() failed: %s\n",
-            pa_strerror(pa_context_errno(context)));
-    exit(1);
-  }
-  pa_context_set_state_callback(context, context_state_callback, data);
-  while (pa_context_get_state(context) != PA_CONTEXT_READY) {
-    pa_threaded_mainloop_wait(mainloop);
-  }
-  pa_threaded_mainloop_unlock(mainloop);
-
-  data->context = context;
-  data->failed = false;
-
-  pa_context_set_subscribe_callback(context, subscribe_callback, data);
-  pa_context_subscribe(context, data->pa_subscriptionType, NULL, data);
-  return context;
+       pa_context *context = pa_context_new(mainloop_api, "PulseAudio Test");
+       if (!context) {
+               fprintf(stderr, "pa_context_new() failed\n");
+               exit(1);
+       }
+
+       pa_threaded_mainloop_lock(mainloop);
+       if (pa_context_connect(context, NULL, PA_CONTEXT_NOAUTOSPAWN, NULL) < 
0) {
+               fprintf(stderr, "pa_context_connect() failed: %s\n",
+                               pa_strerror(pa_context_errno(context)));
+               exit(1);
+       }
+       pa_context_set_state_callback(context, context_state_callback, data);
+       while (pa_context_get_state(context) != PA_CONTEXT_READY) {
+               pa_threaded_mainloop_wait(mainloop);
+       }
+       pa_threaded_mainloop_unlock(mainloop);
+
+       data->context = context;
+       data->failed = false;
+
+       pa_context_set_subscribe_callback(context, subscribe_callback, data);
+       pa_context_subscribe(context, data->pa_subscriptionType, NULL, data);
+       return context;
 }
 
 void Pulse::connect(pa_threaded_mainloop *mainloop,
-                    pa_mainloop_api *mainloop_api,
-                    SubscriptionType subscriptionType,
-                    pa_subscription_mask_t pa_subscriptionType,
-                    EventType eventType) {
-  Data *data = new Data(mainloop, mainloop_api, subscriptionType,
-                        pa_subscriptionType, eventType);
-
-  pa_context *context = getContext(mainloop, mainloop_api, data);
-
-  for (;;) {
-    if (data->failed) {
-      context = getContext(data->mainloop, data->mainloop_api, data);
-    }
-    switch (data->eventCalled) {
-      case EVENT_TYPE_IDLE:
-      case EVENT_TYPE_DRY_BOTH:
-        getRunning(EVENT_TYPE_DRY_SINK, data, context);
-        getRunning(EVENT_TYPE_DRY_SOURCE, data, context);
-        data->handleAction();
-        data->eventCalled = EVENT_TYPE_NONE;
-        break;
-      case EVENT_TYPE_DRY_SINK:
-        getRunning(data->eventCalled, data, context);
-        data->handleAction();
-        data->eventCalled = EVENT_TYPE_NONE;
-        break;
-      case EVENT_TYPE_DRY_SOURCE:
-        getRunning(data->eventCalled, data, context);
-        data->handleAction();
-        data->eventCalled = EVENT_TYPE_NONE;
-        break;
-      case EVENT_TYPE_NONE:
-        pa_threaded_mainloop_lock(mainloop);
-        pa_threaded_mainloop_wait(mainloop);
-        pa_threaded_mainloop_unlock(mainloop);
-        break;
-    }
-  }
+                                       pa_mainloop_api *mainloop_api,
+                                       SubscriptionType subscriptionType,
+                                       pa_subscription_mask_t 
pa_subscriptionType,
+                                       EventType eventType, char 
**ignoredSourceOutputs) {
+       Data *data = new Data(mainloop, mainloop_api, subscriptionType,
+                                                 pa_subscriptionType, 
eventType, ignoredSourceOutputs);
+
+       pa_context *context = getContext(mainloop, mainloop_api, data);
+
+       for (;;) {
+               if (data->failed) {
+                       context = getContext(data->mainloop, 
data->mainloop_api, data);
+               }
+               switch (data->eventCalled) {
+               case EVENT_TYPE_IDLE:
+               case EVENT_TYPE_DRY_BOTH:
+                       getRunning(EVENT_TYPE_DRY_SINK, data, context);
+                       getRunning(EVENT_TYPE_DRY_SOURCE, data, context);
+                       data->handleAction();
+                       data->eventCalled = EVENT_TYPE_NONE;
+                       break;
+               case EVENT_TYPE_DRY_SINK:
+                       getRunning(data->eventCalled, data, context);
+                       data->handleAction();
+                       data->eventCalled = EVENT_TYPE_NONE;
+                       break;
+               case EVENT_TYPE_DRY_SOURCE:
+                       getRunning(data->eventCalled, data, context);
+                       data->handleAction();
+                       data->eventCalled = EVENT_TYPE_NONE;
+                       break;
+               case EVENT_TYPE_NONE:
+                       pa_threaded_mainloop_lock(mainloop);
+                       pa_threaded_mainloop_wait(mainloop);
+                       pa_threaded_mainloop_unlock(mainloop);
+                       break;
+               }
+       }
 }
 
 pa_threaded_mainloop *Pulse::getMainLoop() {
-  pa_threaded_mainloop *mainloop = pa_threaded_mainloop_new();
-  if (!mainloop) {
-    fprintf(stderr, "pa_mainloop_new() failed.\n");
-    exit(1);
-  }
-  return mainloop;
+       pa_threaded_mainloop *mainloop = pa_threaded_mainloop_new();
+       if (!mainloop) {
+               fprintf(stderr, "pa_mainloop_new() failed.\n");
+               exit(1);
+       }
+       return mainloop;
 }
 
 pa_mainloop_api *Pulse::getMainLoopApi(pa_threaded_mainloop *mainloop) {
-  pa_threaded_mainloop_lock(mainloop);
-  pa_mainloop_api *mainloop_api = pa_threaded_mainloop_get_api(mainloop);
-  pa_threaded_mainloop_unlock(mainloop);
-
-  if (pa_signal_init(mainloop_api) != 0) {
-    fprintf(stderr, "pa_signal_init() failed\n");
-    exit(1);
-  }
-  return mainloop_api;
+       pa_threaded_mainloop_lock(mainloop);
+       pa_mainloop_api *mainloop_api = pa_threaded_mainloop_get_api(mainloop);
+       pa_threaded_mainloop_unlock(mainloop);
+
+       if (pa_signal_init(mainloop_api) != 0) {
+               fprintf(stderr, "pa_signal_init() failed\n");
+               exit(1);
+       }
+       return mainloop_api;
 }

Reply via email to