buzz / volctl

Per-application volume control and OSD for Linux desktops.
https://buzz.github.io/volctl/
GNU General Public License v2.0
132 stars 19 forks source link

Allow usage of complex commands for mixer #75

Closed ebiscaia closed 6 months ago

ebiscaia commented 1 year ago

Hi,

I would like to use pulsemixer as my mixer, but it does not start. I tested it and it seems that the program is not able to run commands that has more than one word and special characters. Examples:

I think it is the way the Popen works, but not completely sure.

Thanks

buzz commented 1 year ago

https://github.com/buzz/volctl/blob/2d173bcb8e139846eccd23b8af22b2e836e4f877/volctl/app.py#L203-L210

I agree that the current implementation is deficient as it only supports a single command name and no arguments. It should be extended to use shlex.split to properly parse the command and pass it to Popen. I'm happy to accept a PR.

In the meantime you can use a wrapper shell script as a workaround.

ebiscaia commented 1 year ago

Ok,

I managed to make it work at least in my situation. Before:

def launch_mixer(self): 
     """Launch external mixer.""" 
     mixer_cmd = self.settings.get_string("mixer-command")
     if mixer_cmd == "": 
         mixer_cmd = DEFAULT_MIXER_CMD 

After:

def launch_mixer(self): 
     """Launch external mixer.""" 
     mixer_cmd_str = self.settings.get_string("mixer-command")
     if mixer_cmd_str == "": 
         mixer_cmd = DEFAULT_MIXER_CMD
     else:
         mixer_cmd = mixer_cmd_str.rsplit(" ")

Hope that helps,

Eddie

buzz commented 6 months ago

fixed in #85