Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Control sources and pipewire compatible #4

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

eylles
Copy link
Contributor

@eylles eylles commented Dec 15, 2021

should have opened this before your most recent commit, will have to resolve conflicts but for now i opened for visibility.

this PR not only adds the abilty to control pulse sources but also makes an important change, instead of parsing the output of pacmd now it parses the output of 2 paclt commands which get the mute or volume of the default sink (or source).

this should make the internal logic a bit simpler i guess on top of giving pipewire support, mind you i have not tested how this behaves with pipewire since my setup still uses pulse.

eventually i would like to migrate this module from using io.popen to use one of the async functions of awesomewm perhaps awful.spawn.with_line_callback but i'm leaving that for another PR

@hishamhm
Copy link
Member

@eylles thank you! the PR looks good, could you fix the conflicts to make this mergeable?

Also, instead of control_source as a boolean, perhaps it should be control with "source" and "sink" as valid options?

@eylles
Copy link
Contributor Author

eylles commented Dec 19, 2021

@eylles thank you! the PR looks good, could you fix the conflicts to make this mergeable?

Also, instead of control_source as a boolean, perhaps it should be control with "source" and "sink" as valid options?

after having dealt with a PR to a module that had a boolean in the input table i will have to say yes, i guess keeping the vars table as is should be okay.

also i'm changing the control_source var to a more descriptive device_type

@eylles
Copy link
Contributor Author

eylles commented Dec 20, 2021

i couldn't figure out a way to make this fully async without a substantial rewrite, as such i've decided to take that route and write my own sound widget from scratch.

please do not feel obligated to merge this PR, it has quite some substantial changes in the logic and working of the widget for making it work only with pactl for starters i replaced pacmd with the pactl commands get-sink-volume and get-sink-mute, to not have to use the command get-default-sink i used a macro supported by pactl @DEFAULT_SINK@, another hacky change was on the logic for state, and that i made it only update partially, that way the volume change actions won't impact the mute state, also since using the macros the state no longer needs to save the name of the default sink to have the ability to control a source with an instance of the sound widget i added the if to substitute the correct case variation of the word source into the command string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants