stockmind / gpd-pocket-ubuntu-respin

Collection of scripts and tweaks to adapt Ubuntu and Linux Mint ISO images to let them run smooth on GPD Pocket
349 stars 35 forks source link

Audio jack switch with zsh #107

Open ViktorWalter opened 6 years ago

ViktorWalter commented 6 years ago

For users who use zsh as the primary shell, the [Out] in the headphone-jack.sh script needs to be escaped in order to work. I have solved this for myself by removing the [Out] from the sink variables and putting it to the final command as "pacmd set-sink-port alsa_output.platform-cht-bsw-rt5645.HiFi__hw_chtrt5645__sink \"[Out] $sink\"".

stockmind commented 6 years ago

Hi, thanks for the tip! I also use zsh as my primary shell, but script is launched with bash shebang, so shouldn't be run under bash? there is something i'm missing?

Also, just to know, what kernel version are you using?

ViktorWalter commented 6 years ago

Yeah, the #!/bin/bash would normally pass everything to bash, but later on the command for output device selection is passed to su "$user" which invokes the user's default shell again. My kernel is the current 4.16.0-rc3, updated yesterday through your script. Also I have corrected my previous message - I forgot to set the command to code, so the escaping was invisible.

stockmind commented 6 years ago

Great! sorry for the mistake. What about call the command and bind it to /bin/bash? To let the command work independently from the main shell used? Something like:

su "$user" -s /bin/bash -c "pacmd set-sink-port alsa_output.platform-cht-bsw-rt5645.HiFi__hw_chtrt5645__sink $sink"