toadjaune / pulseaudio-config

Scripts and notes for custom pulseaudio configuration
GNU Affero General Public License v3.0
240 stars 28 forks source link

Added possibility to unload modules and automatic unload when rerunning #3

Closed Xartos closed 3 years ago

Xartos commented 3 years ago

Thanks for this great repo it has been very useful for me.

Although I have suggestions to some "quality of life" stuff to make it possible to run the script multiple times. At least for me this makes it a bit easier if something goes wrong and you need to reapply the setup, it's nice to be able to just run the same command again instead of looking up the module ids and unloading them. And to be able to reset your setup after you're done using it.

toadjaune commented 3 years ago

This looks good to me, I assume that it still works fine even if the modules_lists.txt file exists, but the corresonding devices don't exist anymore ? Which would typically happen on a reboot

Xartos commented 3 years ago

That is a very good point. Depending on how much modules you're loading/unload, it could definitely unload some modules it shouldn't.

But when you run this and load the modules it should add ID's that is bigger than what the autoloaded modules are for a static setup. If you then restart the system the ID's in this file shouldn't exist. Then again assuming a static setup.

But I could add a flag so that this feature is an opt-in feature rather than it always running and potentially causing havoc

toadjaune commented 3 years ago

Just had another idea : How about writing the modules_lists.txt to /tmp ? This way, it won't be persisted when rebooting.

Also, the README doesn't reflect the new opt-in behaviour.

I was also wondering if simply letting the user unload and reload themselves (for example with a one-liner such as ./pulse_unload.sh && ./pulse_setup.sh) would be better ; it makes both implementation and understanding dead simple.

What do you think ?

Xartos commented 3 years ago

Yes and yes! I totally agree. The scripts feel much cleaner and understandable now.

I also added some sanity checks for the unloading as well. I doubt it's super necessary but just to be sure.

toadjaune commented 3 years ago

That looks good, thanks a lot :)