Commit Graph

3829 Commits

Author SHA1 Message Date
6d28740896 Add locking for interacting with the pulseaudio thread
Before this commit, Waybar would sometimes get into a state
where it would consume 100% of a CPU core, and the pulseaudio widget
would stop responding to volume adjustments.

In this state, the pulseaudio mainloop thread would spin, with the
counter of enabled defer events at 1, but no actual enabled defer
event in the list to get the counter back to zero after an iteration
in the mainloop.

This could happen if the unsynchronized interactions with the mainloop
thread happened to modify the list of deferred events at the same
time as the mainloop.

This commit introduces locking in accordance with the PulseAudio
documentation on the threaded mainloop:

> The lock needs to be held whenever you call any PulseAudio function that
> uses an object associated with this main loop. Those objects include
> pa_mainloop, pa_context, pa_stream and pa_operation, and the various event
> objects (pa_io_event, pa_time_event, pa_defer_event).
2024-12-03 19:37:36 +01:00
3abac0abfd Merge pull request #3800 from Alexays/update_flake_lock_action
flake.lock: Update
2024-12-01 12:03:59 +01:00
0e5728b533 flake.lock: Update
Flake lock file updates:

• Updated input 'flake-compat':
    'github:edolstra/flake-compat/0f9255e01c2351cc7d116c072cb317785dd33b33?narHash=sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U%3D' (2023-10-04)
  → 'github:edolstra/flake-compat/9ed2ac151eada2306ca8c418ebd97807bb08f6ac?narHash=sha256-HRJ/18p%2BWoXpWJkcdsk9St5ZiukCqSDgbOGFa8Okehg%3D' (2024-11-27)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/807e9154dcb16384b1b765ebe9cd2bba2ac287fd?narHash=sha256-l253w0XMT8nWHGXuXqyiIC/bMvh1VRszGXgdpQlfhvU%3D' (2024-10-29)
  → 'github:NixOS/nixpkgs/970e93b9f82e2a0f3675757eb0bfc73297cc6370?narHash=sha256-jNRNr49UiuIwaarqijgdTR2qLPifxsVhlJrKzQ8XUIE%3D' (2024-11-28)
2024-12-01 00:12:55 +00:00
4e05659109 sway/workspaces: use X11 class for XWayland windows
When using `window-rewrite`, the `class<>` rule would previously only
match against the `app_id` of a window. However, XWayland windows don't
have an app ID.

This change falls back to checking the `class` window property if there
is no app ID to support matching against XWayland windows.
2024-12-01 12:48:07 +13:00
20ca48c3b8 Merge pull request #3768 from deprekated/fix_privacy_null_deref
fix null-deref due to unconstructed PrivacyNodeInfo
2024-11-20 09:02:38 +01:00
b863627c22 Merge pull request #3730 from TripleTrable/AModuls/expand-fill-no-center
Add stretching of modules and  modules-center toggling
2024-11-20 09:01:33 +01:00
1e481b7ac0 fix broken clang-format to run pipeline 2024-11-20 00:00:51 +01:00
f9acc1fed9 Add stretching of modules and modules-center toggling
This Patch allows the stretching of modules-{left,center,right} as well
add a "expand" flag to AModule. This allows one module to consume the
leftover space.
To allow the left or right modules to fully consume the center, the
changes also include a way to remove the center box (center_)
altogether.
2024-11-20 00:00:27 +01:00
86ce9f7278 fix null-deref due to unconstructed PrivacyNodeInfo
This would cause Waybar to crash if the privacy module ever got
e.g. a empty (but properly null-terminated) string for the
application_name.
2024-11-15 12:32:55 -07:00
8645115619 Merge pull request #3736 from Alexays/update_flake_lock_action
flake.lock: Update
2024-11-13 16:36:28 +01:00
63edb402ef Merge pull request #3747 from Aqa-Ib/patch-1
fix hyprland's grouped window flags
2024-11-13 15:42:38 +01:00
52d582b93a Merge pull request #3758 from ArijanJ/signals-in-manpage 2024-11-10 17:28:07 +01:00
724a4a5ed3 Add signals section to manpage 2024-11-10 12:50:26 +01:00
77b50b4c7a fix hyprland's grouped window flags
Both flags are wrong, because:
- the active group member can be fullscreened.
- technically, a grouped window can be solo as well, because only the active group member is shown, the other members are hidden. Also you can have a group consisting of only one window.
2024-11-06 13:07:09 +00:00
3f80e507fd flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/06cf0e1da4208d3766d898b7fdab6513366d45b9?narHash=sha256-S5kVU7U82LfpEukbn/ihcyNt2%2BEvG7Z5unsKW9H/yFA%3D' (2024-09-29)
  → 'github:NixOS/nixpkgs/807e9154dcb16384b1b765ebe9cd2bba2ac287fd?narHash=sha256-l253w0XMT8nWHGXuXqyiIC/bMvh1VRszGXgdpQlfhvU%3D' (2024-10-29)
2024-11-01 00:11:22 +00:00
5f260516af Merge pull request #3674 from PassiHD2004/master
Add warning threshold to temperature module
2024-10-25 08:52:44 +02:00
9d89ddae9b Merge pull request #3464 from findus/pulseaudio-default-sink
pulseaudio: volume indicator update on default output switch
2024-10-25 08:52:18 +02:00
bb40e169fd feat: update man page 2024-10-22 10:56:26 +02:00
dacecb9b26 Merge pull request #3695 from cfillion/fix-hyprland-crashes
Fix a crash after handling SIGINT and a data race when initializing the Hyprland workspace modules
2024-10-21 14:58:34 +02:00
92242f0b9d hyprland: fix a data race at startup between sockets 1 and 2
`Workspaces::*` and `IPC::startIPC` may both call `getSocketFolder` at the same time.

This randomly causes crashes and/or corruption of the socket path.

Typical crash A:

    [2024-10-16 07:42:09.987] [info] Hyprland IPC starting
    malloc(): unaligned tcache chunk detected
    [2024-10-16 07:42:09.987] [error] Hyprland IPC: Unable to connect?
    Thread 1 "waybar" received signal SIGABRT, Aborted.
    (gdb) bt
    #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
    (omitted for brievety)
    #9  0x00007ffff64ae745 in operator new (sz=sz@entry=296) at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/new_op.cc:50
    #10 0x00007ffff65ab1f1 in std::filesystem::__cxx11::path::_List::_Impl::copy (this=0x555555a23350) at /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++17/fs_path.cc:249
    #11 0x00007ffff65ab3bd in std::filesystem::__cxx11::path::_List::_List (this=0x7fffffff9d30, other=<optimized out>) at /usr/src/debug/gcc/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/unique_ptr.h:454
    #12 0x00005555556f4ab1 in waybar::modules::hyprland::IPC::getSocket1Reply(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
    #13 0x00005555556f5e3d in waybar::modules::hyprland::IPC::getSocket1JsonReply(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
    #14 0x000055555571289c in waybar::modules::hyprland::Workspaces::setCurrentMonitorId() ()

Typical crash B:

    [2024-10-16 10:01:15.859] [info] Hyprland IPC starting
    [2024-10-16 10:01:15.859] [info] Loading persistent workspaces from Hyprland workspace rules
    Thread 8 "waybar" received signal SIGSEGV, Segmentation fault.
    (gdb) bt
    #0  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_copy
        (__d=0x5555558fbca8 "/", __s=0x2973961a26d35726 <error: Cannot access memory at address 0x2973961a26d35726>, __n=1)
        at /usr/src/debug/gcc/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:433
    (omitted for brievety)
    #15 waybar::modules::hyprland::IPC::getSocketFolder[abi:cxx11](char const*)
        (instanceSig=0x7fffffffe604 "4520b30d498daca8079365bdb909a8dea38e8d55_1729051218_1982280648") at ../src/modules/hyprland/backend.cpp:41
    #16 0x000055555564230f in waybar::modules::hyprland::IPC::startIPC()::{lambda()#1}::operator()() const ()
        at ../src/modules/hyprland/backend.cpp:70
    #17 0x00007ffff64e1c34 in std::execute_native_thread_routine (__p=0x5555558119c0) at /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:104
    #18 0x00007ffff62a339d in start_thread (arg=<optimized out>) at pthread_create.c:447
2024-10-17 06:46:07 -04:00
0e03c7a811 fix a segfault on signals received after main returns
The waybar process does not exit instantaneously.
Signals may be recevied after main has started freeing resources.

When a worker thread is in `fgets` this time window can last forever.
An easy way to duplicate the crash is pressing ^C twice with a Hyprland module.

    Thread 1 "waybar" received signal SIGSEGV, Segmentation fault.
    spdlog::sinks::sink::should_log (this=0x5f620b542ca5,
        msg_level=spdlog::level::info)
        at /usr/src/debug/spdlog/spdlog-1.14.1/include/spdlog/sinks/sink-inl.h:13
    13	  return msg_level >= level_.load(std::memory_order_relaxed);
    (gdb) p $_siginfo._sifields._sigfault.si_addr
    $1 = (void *) 0x5f620b542cad
2024-10-16 10:04:04 -04:00
6df26ccba7 feat: add warning threshold to temperature module
Signed-off-by: PassiHD <passihd@phoenixts.eu>
2024-10-09 20:22:58 +02:00
280f11e247 Merge pull request #3658 from Alexays/update_flake_lock_action 2024-10-01 07:42:02 +02:00
95eaffcfb1 flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/4f807e8940284ad7925ebd0a0993d2a1791acb2f?narHash=sha256-IiA3jfbR7K/B5%2B9byVi9BZGWTD4VSbWe8VLpp9B/iYk%3D' (2024-09-11)
  → 'github:NixOS/nixpkgs/06cf0e1da4208d3766d898b7fdab6513366d45b9?narHash=sha256-S5kVU7U82LfpEukbn/ihcyNt2%2BEvG7Z5unsKW9H/yFA%3D' (2024-09-29)
2024-10-01 00:11:21 +00:00
e7b2d33d99 Merge pull request #3637 from TripleTrable/backlight/add_min_brightness
#2275  Backlight: Add minimum brightness
2024-09-30 09:17:15 +02:00
281911c9b3 Merge pull request #3652 from khaneliman/flake 2024-09-29 09:06:40 +02:00
e53497bab6 .github/workflows: allow forks to manually run flake lock update 2024-09-28 13:21:55 -05:00
a1adf6847f Merge pull request #3650 from khaneliman/nix 2024-09-28 20:16:12 +02:00
6322fa28f3 Merge pull request #3651 from khaneliman/github 2024-09-28 20:15:50 +02:00
e394485857 .github/workflows: don't run on forks 2024-09-28 12:55:47 -05:00
edab49f291 nix/default: cava bump 2024-09-28 12:41:10 -05:00
486b99c22f Merge pull request #3646 from LukashonakV/cava_bump 2024-09-28 07:54:57 +02:00
e46a1c6bfc cava bump
Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>
2024-09-28 00:57:02 +03:00
d684a6de21 Backlight: Set default to 0 to prevent breaking existing setups 2024-09-25 16:37:21 +02:00
cad18f39f5 Merge pull request #3640 from mslxl/master
nix: remove patches from downstream
2024-09-25 14:18:52 +02:00
47f767b0ee Backlight: Add documentation for min-brightness 2024-09-25 06:24:24 +02:00
04bda9f443 Backlight: Add minimum brightness
As currently it is possible to turn the brightness to zero which may not
be desirable, this patch add a configurable brightness check.
2024-09-25 06:24:03 +02:00
c88a86f510 nix: remove patches from downstream
The patches is the modification of downstream, it should not affect upstream. Any changes of upstream would caused patch fail.
2024-09-25 10:01:41 +08:00
2dfef1c213 Issue-3092 Add node type to wireplumber logs
- The module only fetches nodes for "node-type". This causes the 'onMixerChanged' log to spam whenever two or more
  wireplumber modules were registered on different nodes. To reduce this the unknown node warning will now only print
  if the node is not the focus of any current module.
2024-09-25 05:06:15 +10:00
71a53eb79d Issue-3092 Add source support to wireplumber module
- Adds microphone support etc to the wireplumber module.

  The existing module hardcodes the selected node type to "Audio/Sink". This feature allows the user to override this
  via `"node-type": "Audio/Source"`.

- Unlike the pulseaudio module, this change does not try to see the module manage both input and output. The same effect
  can be achieved by running two instances of the wireplumber module.

  This approach:
  - Works around some of the complexity overhead that seem to have caused similar PRs to stall.
  - Using separate module instances also allows both the microphone and speaker levels to be controlled with a scroll
    wheel. This is something a unified module like pulseaudio struggles with.
  - Similarly, separate instances allows the source volume level to be exposed as the state. Ie- the linear-gradient
    css patterns can be applied to both input and output.
2024-09-25 05:03:24 +10:00
07f75e303c Merge pull request #3632 from LukashonakV/ISSUE#3383
Fix: 3383. Clock. Default value for cldYearShift_ = 1900/01/01
2024-09-23 17:45:03 +02:00
b4e97eb2f4 FreeBSD format fix
Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>
2024-09-23 16:06:50 +03:00
773b1d4806 Default value for cldYearShift_ = 1900/01/01
Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>
2024-09-23 15:51:01 +03:00
57156bce7e removed manual flag from clang format again 2024-09-21 13:25:36 +02:00
e3095c6d1d clang-format 2024-09-21 13:25:36 +02:00
951b89ffcb Update clang-format.yml
workflow dispatch to debug failing workflow manually
2024-09-21 13:25:36 +02:00
d6bfeb5a44 added is running condition to default_sink_is_running check 2024-09-21 13:25:36 +02:00
8b1d73690d added running check to default sink return condition 2024-09-21 13:25:36 +02:00
9c47b2e9dd removed debug logging 2024-09-21 13:25:36 +02:00
dedee8cd14 pulseaudio: show correct sink volume on default output changes
on sinkInfo callbacks, the default sink now has highest priority.
That fixes an issue that the volume indicator is not updated when
the changes the default output to another devices.

added PA_SINK_IDLE as valid state. PA_SINK_RUNNING is only true
if any sound output is happening on sink switch. Indicator should
also update when no sound is being played.
2024-09-21 13:25:36 +02:00