mpapis / home_dotfiles

my personal dotfiles from my $HOME dir
16 stars 3 forks source link

switch sink by name #4

Open root-hal9000 opened 3 years ago

root-hal9000 commented 3 years ago

Thanks for the audio switch script. I am a little confused about the switching by name part, as I am trying to use that one to add some keyboard shortcuts (the number ids change when I reconnect my bluetooth speakers). when doing it from the command line by name, I have tried several different formats without success - what I am doing wrong here? I guess I don;t know how to pass the name string? Here are some of my attempts

$ ./audio.sh alsa_output.pci-0000_42_00.1.hdmi-stereo-extra3
Usage: ./audio.sh [gui|list|<sink name to switch to>]
$ ./audio.sh <"alsa_output.pci-0000_42_00.1.hdmi-stereo-extra3">
bash: syntax error near unexpected token `newline'
$ ./audio.sh <'alsa_output.pci-0000_42_00.1.hdmi-stereo-extra3'>bash: syntax error near unexpected token `newline'
$ ./audio.sh <alsa_output.pci-0000_42_00.1.hdmi-stereo-extra3>
bash: syntax error near unexpected token `newline'
$ ./audio.sh 'alsa_output.pci-0000_42_00.1.hdmi-stereo-extra3'
Usage: ./audio.sh [gui|list|<sink name to switch to>]
$ ./audio.sh "alsa_output.pci-0000_42_00.1.hdmi-stereo-extra3"
Usage: ./audio.sh [gui|list|<sink name to switch to>]
root-hal9000 commented 3 years ago

also tried removing alsa_output as well as the other prefixes in the name but no dice...

mpapis commented 3 years ago

Now, where is the script? Can't find it ;)

root-hal9000 commented 3 years ago

wait, what? Your audio switch script? From the winky emoji I feel like I am doing/saying something really stupid but I don;t get it PS.: in my home folder, where I am running it successfully but not able to switch by string name, only by output ID, which unfortunately does not persist for my bluetooth devices

mpapis commented 3 years ago

I can not find audio.sh

On Mon, May 17, 2021, 8:28 PM ffcruz85 @.***> wrote:

wait, what? Your audio switch script https://github.com/mpapis/home_dotfiles/blob/4a1b30e36b6e6772d4e99050aca740c14b460aeb/bin/mypa? From the winky emoji I feel like I am doing/saying something really stupid but I don;t get it

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mpapis/home_dotfiles/issues/4#issuecomment-842538865, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALXNQ2T34IC5JNS2BRLODTOFN4LANCNFSM44233WLA .

root-hal9000 commented 3 years ago

I am sorry @mpapis , I just realized I renamed it locally but it is the same file named mypa that I linked above. It is running as intended as you can see from the output above, I just can't do it with the string name parameters that it suggests in its usage line that prints out when run without parameters... Thanks!

root-hal9000 commented 3 years ago

In any case, I will try to mess with the regular command to see 8f I can work out the string issue and edit your script accordingly if I can get it to work that way, in which case I'll share what I did

mpapis commented 3 years ago

aha! try mypa "<alsa_output.pci-0000_00_1f.3.analog-stereo>"

root-hal9000 commented 3 years ago

no, in that case I still get just the Usage help text. I also have some other examples of what I tried in the original post.

In my ignorance, looking at the case statement at the bottom of the file, I don't see an option for handling the text parameter input - or am I wrong?

case "${1:-}" in
  (""|list) list_sinks       ;;
  ([0-9]*)  switch_sink "$@" ;;
  (gui)     switch_gui       ;;
  (*)       help_me          ;;
esac

sorry to bother with this, I know it's an old thing for you