volctl icon indicating copy to clipboard operation
volctl copied to clipboard

Allow usage of complex commands for mixer

Open ebiscaia opened this issue 2 years ago • 2 comments

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:

  • pavucontrol: works
  • kitty: works
  • "kitty": doesn't work
  • kitty --hold pulsemixer: doesn't work (the one I need to work)

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

Thanks

ebiscaia avatar Mar 28 '23 05:03 ebiscaia

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.

buzz avatar Mar 28 '23 13:03 buzz

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

ebiscaia avatar Mar 29 '23 11:03 ebiscaia

fixed in #85

buzz avatar May 02 '24 17:05 buzz