tobi-wan-kenobi / bumblebee-status

bumblebee-status is a modular, theme-able status line generator for the i3 window manager.
https://bumblebee-status.readthedocs.io/en/main/
MIT License
1.22k stars 228 forks source link

[pulseaudio] support event monitoring for faster response times #917

Closed tobi-wan-kenobi closed 2 years ago

tobi-wan-kenobi commented 2 years ago

A follow-up on #913

For the pulseaudio module, it would be nice to support some kind of P.A. event monitoring to adjust the module not periodically, but only when actual changes to pulseaudio happen.

HappyCthulhu commented 2 years ago

So, i have pactl. Should i turn it on somehow? Bc this is stilll present: image

Can it be caused bc something in my i3-configs?

How can i debug this?

tobi-wan-kenobi commented 2 years ago

Can you try enabling logging and calling bumblebee-status from the commandli e?

This looks liks some broken output.

Just past the logfile and the output here and I will take a look.

Thanks!

HappyCthulhu commented 2 years ago

R u talking about that?

> ./bumblebee-status -c ../config
{"version":1}
[
[{"full_text": " File contains no section headers.\nfile: '../config', line: 2\n'set $mod Mod4\\n' ", "background": "#ff0000", "color": "#ffffff", "name": "error", "instance": "the-only-one"}],
[{"full_text": " File contains no section headers.\nfile: '../config', line: 2\n'set $mod Mod4\\n' ", "background": "#ff0000", "color": "#ffffff", "name": "error", "instance": "the-only-one"}],
[{"full_text": " File contains no section headers.\nfile: '../config', line: 2\n'set $mod Mod4\\n' ", "background": "#ff0000", "color": "#ffffff", "name": "error", "instance": "the-only-one"}],
[{"full_text": " File contains no section headers.\nfile: '../config', line: 2\n'set $mod Mod4\\n' ", "background": "#ff0000", "color": "#ffffff", "name": "error", "instance": "the-only-one"}],

My i3 config: https://github.com/HappyCthulhu/.config/blob/master/i3/config

tobi-wan-kenobi commented 2 years ago

Ah, that does not have anything to do with my changes. Seems your config file has syntax errors.

I cannot open the link, is it possible that the repo is private?

HappyCthulhu commented 2 years ago

I think, your changes caused this problem. Bc when i remove pasink module, problem disappears. And when i switching from local branch to main)

Yeah, sorry, repo was private. Change visibility to public.

tobi-wan-kenobi commented 2 years ago

Haha, this is going to be an interesting one...

tobi-wan-kenobi commented 2 years ago

Ah, wait - please call bumblebeee-status like it is on your config (ie just copy the whole command), passing the i3 config to bumblebee-status does not work.

e.g.

bumblebee-status -m pasink -d and paste what you get, olease.

Thank you!

HappyCthulhu commented 2 years ago

Yeah, i thought about it, but before your changes it worked well...

Output ``` > ./bumblebee-status -m pasink -d [2022-08-31 16:18:54,260] input DEBUG registering callback ::wheel-up [2022-08-31 16:18:54,260] input DEBUG registering callback ::wheel-down [2022-08-31 16:18:54,264] module DEBUG importing debug from core [2022-08-31 16:18:54,271] module DEBUG importing pasink from core [2022-08-31 16:18:54,271] input DEBUG registering callback pasink::right-mouse [2022-08-31 16:18:54,272] input DEBUG registering callback pasink::left-mouse [2022-08-31 16:18:54,272] input DEBUG registering callback pasink::wheel-up [2022-08-31 16:18:54,272] input DEBUG registering callback pasink::wheel-down [2022-08-31 16:18:54,274] cli DEBUG pactl info [2022-08-31 16:18:54,275] input DEBUG registering callback ::middle-mouse {"version": 1, "click_events": true} [ [{"full_text": " debug ", "color": "#aabbcc", "name": "debug", "instance": "61ccdd01-c71f-492a-94cb-ae3134ba5dad", "_raw": "debug", "_suffix": " ", "_prefix": " ", "align": null}, {"full_text": " audio 0% ", "color": "#aabbcc", "name": "pasink", "instance": "cf6fea91-a306-45d3-b3fb-2ecdab996564", "_raw": "0%", "_suffix": " ", "_prefix": " audio ", "align": null}], [2022-08-31 16:18:54,310] cli DEBUG Server String: /run/user/1000/pulse/native Library Protocol Version: 33 Server Protocol Version: 33 Is Local: yes Client Index: 96486 Tile Size: 65472 User Name: valera Host Name: valera-thinkpad Server Name: pulseaudio Server Version: 13.99.1 Default Sample Specification: s16le 2ch 44100Hz Default Channel Map: front-left,front-right Default Sink: alsa_output.pci-0000_00_1b.0.analog-stereo Default Source: alsa_input.pci-0000_00_1b.0.analog-stereo Cookie: a676:dbe7 [2022-08-31 16:18:54,313] cli DEBUG pactl list sinks [2022-08-31 16:18:54,346] cli DEBUG Sink #1 State: IDLE Name: alsa_output.pci-0000_00_1b.0.analog-stereo Description: Built-in Audio Analog Stereo Driver: module-alsa-card.c Sample Specification: s16le 2ch 44100Hz Channel Map: front-left,front-right Owner Module: 8 Mute: no Volume: front-left: 73685 / 112% / 3.05 dB, front-right: 73685 / 112% / 3.05 dB balance 0.00 Base Volume: 65536 / 100% / 0.00 dB Monitor Source: alsa_output.pci-0000_00_1b.0.analog-stereo.monitor Latency: 22869 usec, configured 23220 usec Flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY Properties: alsa.resolution_bits = "16" device.api = "alsa" device.class = "sound" alsa.class = "generic" alsa.subclass = "generic-mix" alsa.name = "ALC3232 Analog" alsa.id = "ALC3232 Analog" alsa.subdevice = "0" alsa.subdevice_name = "subdevice #0" alsa.device = "0" alsa.card = "1" alsa.card_name = "HDA Intel PCH" alsa.long_card_name = "HDA Intel PCH at 0xe1234000 irq 52" alsa.driver_name = "snd_hda_intel" device.bus_path = "pci-0000:00:1b.0" sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card1" device.bus = "pci" device.vendor.id = "8086" device.vendor.name = "Intel Corporation" device.product.id = "9ca0" device.product.name = "Wildcat Point-LP High Definition Audio Controller" device.form_factor = "internal" device.string = "front:1" device.buffering.buffer_size = "352800" device.buffering.fragment_size = "176400" device.access_mode = "mmap+timer" device.profile.name = "analog-stereo" device.profile.description = "Analog Stereo" device.description = "Built-in Audio Analog Stereo" module-udev-detect.discovered = "1" device.icon_name = "audio-card-pci" Ports: analog-output-speaker: Speakers (priority: 10000) analog-output-headphones: Headphones (priority: 9900, not available) Active Port: analog-output-speaker Formats: pcm Sink #20 State: SUSPENDED Name: alsa_output.pci-0000_00_03.0.hdmi-stereo-extra1 Description: Built-in Audio Digital Stereo (HDMI 2) Driver: module-alsa-card.c Sample Specification: s16le 2ch 44100Hz Channel Map: front-left,front-right Owner Module: 7 Mute: no Volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB balance 0.00 Base Volume: 65536 / 100% / 0.00 dB Monitor Source: alsa_output.pci-0000_00_03.0.hdmi-stereo-extra1.monitor Latency: 0 usec, configured 0 usec Flags: HARDWARE DECIBEL_VOLUME LATENCY SET_FORMATS Properties: alsa.resolution_bits = "16" device.api = "alsa" device.class = "sound" alsa.class = "generic" alsa.subclass = "generic-mix" alsa.name = "HDMI 1" alsa.id = "HDMI 1" alsa.subdevice = "0" alsa.subdevice_name = "subdevice #0" alsa.device = "7" alsa.card = "0" alsa.card_name = "HDA Intel HDMI" alsa.long_card_name = "HDA Intel HDMI at 0xe1230000 irq 51" alsa.driver_name = "snd_hda_intel" device.bus_path = "pci-0000:00:03.0" sysfs.path = "/devices/pci0000:00/0000:00:03.0/sound/card0" device.bus = "pci" device.vendor.id = "8086" device.vendor.name = "Intel Corporation" device.product.id = "160c" device.product.name = "Broadwell-U Audio Controller" device.form_factor = "internal" device.string = "hdmi:0,1" device.buffering.buffer_size = "352768" device.buffering.fragment_size = "176384" device.access_mode = "mmap+timer" device.profile.name = "hdmi-stereo-extra1" device.profile.description = "Digital Stereo (HDMI 2)" device.description = "Built-in Audio Digital Stereo (HDMI 2)" module-udev-detect.discovered = "1" device.icon_name = "audio-card-pci" Ports: hdmi-output-1: HDMI / DisplayPort 2 (priority: 5800, available) Active Port: hdmi-output-1 Formats: pcm [{"full_text": " debug ", "color": "#aabbcc", "name": "debug", "instance": "61ccdd01-c71f-492a-94cb-ae3134ba5dad", "_raw": "debug", "_suffix": " ", "_prefix": " ", "align": null}, {"full_text": " audio 112% ", "color": "#aabbcc", "name": "pasink", "instance": "cf6fea91-a306-45d3-b3fb-2ecdab996564", "_raw": "112%", "_suffix": " ", "_prefix": " audio ", "align": null}], [{"full_text": " debug ", "color": "#aabbcc", "name": "debug", "instance": "61ccdd01-c71f-492a-94cb-ae3134ba5dad", "_raw": "debug", "_suffix": " ", "_prefix": " ", "align": null}, {"full_text": " audio 112% ", "color": "#aabbcc", "name": "pasink", "instance": "cf6fea91-a306-45d3-b3fb-2ecdab996564", "_raw": "112%", "_suffix": " ", "_prefix": " audio ", "align": null}], [{"full_text": " debug ", "color": "#aabbcc", "name": "debug", "instance": "61ccdd01-c71f-492a-94cb-ae3134ba5dad", "_raw": "debug", "_suffix": " ", "_prefix": " ", "align": null}, {"full_text": " audio 112% ", "color": "#aabbcc", "name": "pasink", "instance": "cf6fea91-a306-45d3-b3fb-2ecdab996564", "_raw": "112%", "_suffix": " ", "_prefix": " audio ", "align": null}], [{"full_text": " debug ", "color": "#aabbcc", "name": "debug", "instance": "61ccdd01-c71f-492a-94cb-ae3134ba5dad", "_raw": "debug", "_suffix": " ", "_prefix": " ", "align": null}, {"full_text": " audio 112% ", "color": "#aabbcc", "name": "pasink", "instance": "cf6fea91-a306-45d3-b3fb-2ecdab996564", "_raw": "112%", "_suffix": " ", "_prefix": " audio ", "align": null}], ^CTraceback (most recent call last): File "/home/valera/.config/i3/bumblebee-status/bumblebee-status", line 146, in main() File "/home/valera/.config/i3/bumblebee-status/bumblebee-status", line 138, in main output.wait(config.interval()) File "/home/valera/.config/i3/bumblebee-status/bumblebee_status/core/output.py", line 275, in wait time.sleep(interval) KeyboardInterrupt ```
tobi-wan-kenobi commented 2 years ago

strange, that looks good, actually :(

HappyCthulhu commented 2 years ago
Calling th whole command > ~/.config/i3/bumblebee-status/bumblebee-status \ -m layout-xkb \ -m pasink \ -m battery \ -m time \ -m date \ -m nic \ -m publicip \ -m disk:root \ -m cpu \ -m memory \ -m docker_ps \ -m arandr \ -p root.path=/ \ -p time.format="%H:%M" \ -p date.format="%a, %-d %-m" date.left-click="zenity --calendar" \ -p battery.device="BAT1" \ -p nic.exclude="lo,enp0s25,docker0,br-0e4b347152f3" \ -p nic.format="{ssid} {ip}" \ -p memory.format="{percent:05.02f}%" \ -p disk.format="{left}" \ -t nord-powerline [], /usr/local/lib/python3.8/dist-packages/paramiko/transport.py:236: CryptographyDeprecationWarning: Blowfish has been deprecated "class": algorithms.Blowfish, {"version": 1, "click_events": true} [ [{"full_text": "\ue0b2", "separator": false, "color": "#3B4252", "background": null, "_decorator": true, "name": "layout-xkb", "instance": "1e47e4a3-4a97-4b68-9ba9-b86cd701fd4f", "separator_block_width": 0}, {"full_text": "\u2009\uf1ab\u2009us\u2009", "separator": false, "color": "#D8DEE9", "background": "#3B4252", "name": "layout-xkb", "instance": "1e47e4a3-4a97-4b68-9ba9-b86cd701fd4f", "separator_block_width": 0, "_raw": "us", "_suffix": "\u2009", "_prefix": "\u2009\uf1ab\u2009", "align": null}, {"full_text": "\ue0b2", "separator": false, "color": "#434C5E", "background": "#3B4252", "_decorator": true, "name": "pasink", "instance": "657e326e-f06e-48d5-80d1-ac72c44fb4ef", "separator_block_width": 0}, {"full_text": "\u2009\uf028\u2009112%\u2009", "separator": false, "color": "#D8DEE9", "background": "#434C5E", "name": "pasink", "instance": "657e326e-f06e-48d5-80d1-ac72c44fb4ef", "separator_block_width": 0, "_raw": "112%", "_suffix": "\u2009", "_prefix": "\u2009\uf028\u2009", "align": null}, {"full_text": "\ue0b2", "separator": false, "color": "#A3BE8C", "background": "#434C5E", "_decorator": true, "name": "battery", "instance": "battery::0", "separator_block_width": 0}, {"full_text": "\u2009\uf240\u200996%\u2009\uf1e6\u2009", "separator": false, "color": "#2E3440", "background": "#A3BE8C", "name": "battery", "instance": "battery::0", "separator_block_width": 0, "_raw": "96%", "_suffix": "\u2009\uf1e6\u2009", "_prefix": "\u2009\uf240\u2009", "min_width": "\u2009\uf240\u2009100%\u2009\uf1e6\u2009", "align": null}, {"full_text": "\ue0b2", "separator": false, "color": "#434C5E", "background": "#A3BE8C", "_decorator": true, "name": "time", "instance": "8d547506-545c-48e1-a1e4-802f7512ef14", "separator_block_width": 0}, {"full_text": "\u2009\uf017\u200916:23\u2009", "separator": false, "color": "#D8DEE9", "background": "#434C5E", "name": "time", "instance": "8d547506-545c-48e1-a1e4-802f7512ef14", "separator_block_width": 0, "_raw": "16:23", "_suffix": "\u2009", "_prefix": "\u2009\uf017\u2009", "align": null}, {"full_text": "\ue0b2", "separator": false, "color": "#3B4252", "background": "#434C5E", "_decorator": true, "name": "date", "instance": "cd79491a-5f64-4a2c-9edd-d2bec161876e", "separator_block_width": 0}, {"full_text": "\u2009\uf073\u2009Wed, 31 8\u2009", "separator": false, "color": "#D8DEE9", "background": "#3B4252", "name": "date", "instance": "cd79491a-5f64-4a2c-9edd-d2bec161876e", "separator_block_width": 0, "_raw": "Wed, 31 8", "_suffix": "\u2009", "_prefix": "\u2009\uf073\u2009", "align": null}, {"full_text": "\ue0b2", "separator": false, "color": "#434C5E", "background": "#3B4252", "_decorator": true, "name": "nic", "instance": "nic::0", "separator_block_width": 0}, {"full_text": "\u2009\uf1eb\u2009RT-GPON-E398 192.168.0.5\u2009", "separator": false, "color": "#D8DEE9", "background": "#434C5E", "name": "nic", "instance": "nic::0", "separator_block_width": 0, "_raw": "RT-GPON-E398 192.168.0.5", "_suffix": "\u2009", "_prefix": "\u2009\uf1eb\u2009", "align": null}, {"full_text": "\ue0b2", "separator": false, "color": "#7B8394", "background": "#434C5E", "_decorator": true, "name": "publicip", "instance": "e072580f-0531-4c58-8e2f-65a46a8086c2", "separator_block_width": 0}, {"full_text": "\u2009 \uf0ec \u200991.122.62.240 (RU)\u2009", "separator": false, "color": "#D8DEE9", "background": "#7B8394", "name": "publicip", "instance": "e072580f-0531-4c58-8e2f-65a46a8086c2", "separator_block_width": 0, "_raw": "91.122.62.240 (RU)", "_suffix": "\u2009", "_prefix": "\u2009 \uf0ec \u2009", "align": null}, {"full_text": "\ue0b2", "separator": false, "color": "#434C5E", "background": "#7B8394", "_decorator": true, "name": "root", "instance": "f06be4c8-2e3d-4d45-9d0e-3248e97923a5", "separator_block_width": 0}, {"full_text": "\u2009\uf0a0\u200951.16GiB\u2009", "separator": false, "color": "#D8DEE9", "background": "#434C5E", "name": "root", "instance": "f06be4c8-2e3d-4d45-9d0e-3248e97923a5", "separator_block_width": 0, "_raw": "51.16GiB", "_suffix": "\u2009", "_prefix": "\u2009\uf0a0\u2009", "align": null}, {"full_text": "\ue0b2", "separator": false, "color": "#3B4252", "background": "#434C5E", "_decorator": true, "name": "cpu", "instance": "cpu::0", "separator_block_width": 0}, {"full_text": "\u2009\uf0e4\u200963.9%\u2009", "separator": false, "color": "#D8DEE9", "background": "#3B4252", "name": "cpu", "instance": "cpu::0", "separator_block_width": 0, "_raw": "63.9%", "_suffix": "\u2009", "_prefix": "\u2009\uf0e4\u2009", "min_width": "\u2009\uf0e4\u2009100.0%\u2009", "align": null}, {"full_text": "\ue0b2", "separator": false, "color": "#434C5E", "background": "#3B4252", "_decorator": true, "name": "memory", "instance": "b3c66492-d2d1-486e-b847-21b3dbd40b46", "separator_block_width": 0}, {"full_text": "\u2009\uf145\u200978.04%\u2009", "separator": false, "color": "#D8DEE9", "background": "#434C5E", "name": "memory", "instance": "b3c66492-d2d1-486e-b847-21b3dbd40b46", "separator_block_width": 0, "_raw": "78.04%", "_suffix": "\u2009", "_prefix": "\u2009\uf145\u2009", "align": null}, {"full_text": "\ue0b2", "separator": false, "color": "#D08770", "background": "#434C5E", "_decorator": true, "name": "docker_ps", "instance": "bd0dad41-bdab-4c30-8489-4ee256b4e752", "separator_block_width": 0}, {"full_text": "\u2009\uf21a\u2009OK - 0\u2009", "separator": false, "color": "#2E3440", "background": "#D08770", "name": "docker_ps", "instance": "bd0dad41-bdab-4c30-8489-4ee256b4e752", "separator_block_width": 0, "_raw": "OK - 0", "_suffix": "\u2009", "_prefix": "\u2009\uf21a\u2009", "align": null}, {"full_text": "\ue0b2", "separator": false, "color": "#434C5E", "background": "#D08770", "_decorator": true, "name": "arandr", "instance": "a8b443ce-d96e-4825-95f1-3cdff2a4978e", "separator_block_width": 0}, {"full_text": "\u2009\uf26c\u2009\u2009", "separator": false, "color": "#D8DEE9", "background": "#434C5E", "name": "arandr", "instance": "a8b443ce-d96e-4825-95f1-3cdff2a4978e", "separator_block_width": 0, "_raw": "", "_suffix": "\u2009", "_prefix": "\u2009\uf26c\u2009", "align": null}], ```
HappyCthulhu commented 2 years ago

ahaha u r facing with paramiko errors to))) Yeah, i thought im the only one

tobi-wan-kenobi commented 2 years ago

It could be the paramiko warning, which would be weird, though.

Does it work better if you only use the pasink module in your i3 config for testing?

Weirdly, bumblebee is not using paramiko at all, something must pull it in...

HappyCthulhu commented 2 years ago

Fucking hell, mate) Im facing really weird behaviour. Is it appropriate to make something like chat in telegram, discord, skype, zoom, etc? I just wanna to show u)

I can give u my contacts

HappyCthulhu commented 2 years ago

If it is not appropriate, i can try to explain it in this tread. It just spent more time

tobi-wan-kenobi commented 2 years ago

In principle, I am OK with that, but if it is not too much hassle, I'd be grateful if you could write a summary (between my day job and 2 small kids, I mostly work on bumblebee at night and don't want to wake anybody)

HappyCthulhu commented 2 years ago

Ok, So, tell me, if u will be able to rearch out 2 me somehow.

Summary:

status_command ~/.config/i3/bumblebee-status/bumblebee-status -m layout-xkb pasink battery time date nic 

This works fine. And now we r entering interesting part. When im trying to add something more in this string, im facing error, that was described previously. And im not talking only about modules. If im adding space or backslash, this error appears too.

Ofc, this error disappear if i remove pasink module from status_command

tobi-wan-kenobi commented 2 years ago

YAY, i can reproduce! this is weird

tobi-wan-kenobi commented 2 years ago

@HappyCthulhu Please try again, i am 80% sure your issue should be gone & you should have a nice and working and responsive pulseaudio module.

Thank you very much for your patience!

(If you are interested: Turns out I drew the status line too early - bumblebee-status uses an event-based mechanism for loose coupling internally, and somehow, when too many modules were initialized, the thread would draw before all modules were available, causing a massive mess-up in the status data)

tobi-wan-kenobi commented 2 years ago

btw @HappyCthulhu thank you for an excellent piece of debugging, your error descriptions were really useful, spot on and precise!

HappyCthulhu commented 2 years ago

Yeah, i thought, that this issue is related to length of status-bar. It working cool rn, just facing weird behaviour of color scheme. But that might be my local problem, idk: https://user-images.githubusercontent.com/23531195/187940131-22e75e5e-c528-4106-be00-668957a89765.MOV

No problem, i like bumblestatus very much and thats cool, that i can help u somehow)

Btw, i can help u with some coding part, im a little bit of python dev too.

tobi-wan-kenobi commented 2 years ago

Ah, that probably is a drawing issue, I hope I can fix that easily.

PRs and new code are always appreciated, thanks!

tobi-wan-kenobi commented 2 years ago

Hm, this is very strange again. I cannot reproduce the issue. Are you using different settings than in your .config that you linked?

HappyCthulhu commented 2 years ago

Hm, this is very strange again. I cannot reproduce the issue. Are you using different settings than in your .config that you linked?

Yeah. It can be related to my weak cpu...

tobi-wan-kenobi commented 2 years ago

ah, good hint. will try to implement some subtle rate limiting.

stay tuned :)

tobi-wan-kenobi commented 2 years ago

Sooooo, I have just committed a "rate limiting" to the output that only produces output every 300ms max. That can occasionally cause delays, but normally, should be fine, I think.

Please let me know if it improves your situation or not. If not, you can try playing around with the value in bumblebee_status/core/output.py (method "draw()") - increasing should reduce flickering, but make the bar less responsive.

HappyCthulhu commented 2 years ago

This colour bug happens only on 917 branch. It doesnt appears on main. And no, your bug fix is not working for now

tobi-wan-kenobi commented 2 years ago

Sorry to hear that :-(

Yeah, only the dev branch being affected makes sense, becausechanging the volume causes the event monitor to trigger as well :thinking:

Will try to come up wih an idea to fix that

tobi-wan-kenobi commented 2 years ago

Another idea: I am now rate-limiting the pulseaudio events, but at the same time ensuring the module gets updated regularly.

I hope that this improves the situation a bit (I capped my CPUs to the minimum frequency and scrolled like crazy, and cannot reproduce the flickering anymore - I was able to, before). It lags a lot with events, if you scroll a lot up and down, but that's OK, IMHO.

Hope it works for you as well, @HappyCthulhu

HappyCthulhu commented 2 years ago

i think, that really helped... Looks cool!

HappyCthulhu commented 2 years ago

image bruh, wtf((( still happens sometimes after reloading i3

HappyCthulhu commented 2 years ago

yeah, and colorscheme gleaching without any actions with i3 status...

tobi-wan-kenobi commented 2 years ago

damn, so the race condition isn't solved yet....

I will find a way to fix that, for sure :)

tobi-wan-kenobi commented 2 years ago

one q: the coloracheme glitches don't happen on main, right?

HappyCthulhu commented 2 years ago

one q: the coloracheme glitches don't happen on main, right?

yeah

tobi-wan-kenobi commented 2 years ago

@HappyCthulhu Can I ask you for another round of tests, please?

This time, I feel pretty good about having found a real issue - there was a multithreading concurrency issue between update and draw, if invoked from a separate thread.

HappyCthulhu commented 2 years ago

Now its working fine. Dont close this issue for a day, ok? Just to be sure, that everything is fine.

Btw, could u reproduce this bug on your pc?

tobi-wan-kenobi commented 2 years ago

I was able to partially reproduce it, by clamping down the CPU speed of my machine to the minimum.

Once I realized it was a threading issue, judiciously adding sleeps helped a lot to reproc reliably :)

Plus: I am really glad it looks promising for you, now!

tobi-wan-kenobi commented 2 years ago

@HappyCthulhu Is it OK if I close the issue now? :fingerscrossed:

HappyCthulhu commented 2 years ago

Yeah, all right. I think, u can close issue)

tobi-wan-kenobi commented 2 years ago

@HappyCthulhu Sorry, but this needs work before merging to main - using the module multiple times causes really high cpu load.

I need to find a reliable way to detect volume/state changes for a given device, that is ... surprisingly difficult

tobi-wan-kenobi commented 2 years ago

@HappyCthulhu Sorry to be a bother!

I just pushed a new version - this time something cool :)

I added 2 new modules pulsein (for microphone) and pulseout (for speakers). Those are 100% event-based (using the python module pulsectl, which needs to be installed), and for me, this works like a charm.

Right now, those modules don't have any parameters, but if you report back promising findings, I want to eventually make those "drop-in" replacements for the existing modules.

tobi-wan-kenobi commented 2 years ago

Actually, @HappyCthulhu I will merge this to main right away, as the module is now a real drop-in replacement (all parameters work exactly the same), and there is no impact on other parts of bumblebee-status, hopefully.

I would still highly appreciate your input on whether the module works for you & improves your experience (it doesn't use executables anymore & only has half the lines of code, so it should be much nicer)

HappyCthulhu commented 2 years ago

Didnt have enought time to test your features. I will do it rn. I have some troubles with pulseaudio, so, mb, i will not be able to install your latest modules.

Anyway, this is my telegram, so u can text me even if all issues are closed: https://privnote.com/hsOTFZiG#CBWZdRHxy. Make sure, that u copy telegram in first time, because, when u will open it in second time this note will be destroyed.