From 174a7a3eaa4ad5b5445a5041d9f93220924c906f Mon Sep 17 00:00:00 2001 From: Captain ALM Date: Thu, 14 Nov 2024 10:01:32 +0000 Subject: [PATCH] Add pulseaudio config, fix up bash alises and fix up single instance checking in boot verification and signing. --- bash_aliases | 8 ++++++-- default.pa.d/remap-combine.pa | 17 +++++++++++++++++ local-sbin/sign-boot | 6 +++--- local-sbin/verify-boot | 6 +++--- .../default.pa.append | 5 +++++ 5 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 default.pa.d/remap-combine.pa create mode 100644 share-pulseaudio-alsa-mixer-profile-sets/default.pa.append diff --git a/bash_aliases b/bash_aliases index 1a13fd5..c0663f8 100644 --- a/bash_aliases +++ b/bash_aliases @@ -10,9 +10,10 @@ alias waydroid-launch="weston-phone && waydroid-start & read && waydroid-stop" alias show-waydroid="waydroid-show" alias swd="waydroid-show" alias launch-waydroid="waydroid-launch" -alias screen-off="xset dpms force off" +alias screen-off="sleep 0.1 && xset dpms force off" alias boot-sign-verify="sudo sign-boot && sudo verify-boot" -alias rdp-session-desktop-cvd="xfreerdp3 ~/Downloads/SessionDesktop.rdpw /gateway:type:arm /sec:aad +clipboard /w:1920 /h:1020 +auto-reconnect" +alias rdp-session-desktop-cvd="xfreerdp3 ~/Downloads/SessionDesktop.rdpw /gateway:type:arm /sec:aad +clipboard /w:1920 /h:1000 +auto-reconnect" +alias pulse-restart="systemctl --user stop pulseaudio.socket pulseaudio.service && sleep 1 && systemctl --user start pulseaudio.socket pulseaudio.service" function conda-activate() { eval "$(~/anaconda3/bin/conda shell.bash hook)"; } @@ -229,6 +230,9 @@ function record-screen-x11() { cd "$cwd"; } function search-in-files() { + grep -Rn "$1" -e "$2"; +} +function search-word-in-files() { grep -Rnw "$1" -e "$2"; } function apt-search() { diff --git a/default.pa.d/remap-combine.pa b/default.pa.d/remap-combine.pa new file mode 100644 index 0000000..ab284d5 --- /dev/null +++ b/default.pa.d/remap-combine.pa @@ -0,0 +1,17 @@ +#CALM DEF + +#load-module module-alsa-sink device=hw:0,0 sink_name=internal_speakers +#update-sink-proplist internal_speakers device.icon_name="audio-speakers" + +#load-module module-alsa-sink device=hw:0,3 sink_name=hdmi_speakers +#update-sink-proplist hdmi_speakers device.icon_name="audio-speakers" + +load-module module-remap-sink sink_name=internal_speakers_left master=alsa_output.pci-0000_00_1f.3.analog-stereo channels=2 master_channel_map=front-left,front-right channel_map=front-left,front-center remix=no +update-sink-proplist internal_speakers_left device.description="Remapped internal speakers to front-left and front-center" + +load-module module-remap-sink sink_name=hdmi_speakers_right master=alsa_output.pci-0000_00_1f.3.hdmi-stereo channels=2 master_channel_map=front-left,front-right channel_map=front-center,front-right remix=no +update-sink-proplist hdmi_speakers_right device.description="Remapped HDMI speakers to front-center and front-right" + +load-module module-combine-sink sink_name=is_left_hs_right slaves=internal_speakers_left,hdmi_speakers_right channels=3 channel_map=front-left,front-center,front-right +update-sink-proplist is_left_hs_right device.description="Combined Internal and HDMI Speakers" +update-sink-proplist is_left_hs_right device.icon_name="audio-speakers" diff --git a/local-sbin/sign-boot b/local-sbin/sign-boot index 70a6aac..cb403ae 100755 --- a/local-sbin/sign-boot +++ b/local-sbin/sign-boot @@ -1,10 +1,10 @@ #!/bin/bash if [ -f /run/sign-verify-boot-flag ]; then echo "[-] Waiting for in-progress Signing / Verifying!"; - while lsof /run/sign-verify-boot-flag > /dev/null 2>&1; do sleep 0.1; done - while [ -f /run/sign-verify-boot-flag ]; do sleep 0.1; done + while /usr/bin/lsof /run/sign-verify-boot-flag > /dev/null 2>&1; do sleep 0.1; done + while /usr/bin/kill -0 "$(cat /run/sign-verify-boot-flag)" > /dev/null 2>&1; do sleep 1; done fi; -/usr/bin/touch /run/sign-verify-boot-flag; +/usr/bin/echo -n "$$" > /run/sign-verify-boot-flag; echo "[*] Preparing to sign!"; echo "[-] BMOK Un-Signing..."; for i in $(/usr/bin/find /boot/grub -iname "*.efi" -type f -print) diff --git a/local-sbin/verify-boot b/local-sbin/verify-boot index e2d03e9..ee9f335 100755 --- a/local-sbin/verify-boot +++ b/local-sbin/verify-boot @@ -1,10 +1,10 @@ #!/bin/bash if [ -f /run/sign-verify-boot-flag ]; then echo "[-] Waiting for in-progress Signing / Verifying!"; - while lsof /run/sign-verify-boot-flag > /dev/null 2>&1; do sleep 0.1; done - while [ -f /run/sign-verify-boot-flag ]; do sleep 0.1; done + while /usr/bin/lsof /run/sign-verify-boot-flag > /dev/null 2>&1; do sleep 0.1; done + while /usr/bin/kill -0 "$(cat /run/sign-verify-boot-flag)" > /dev/null 2>&1; do sleep 1; done fi; -/usr/bin/touch /run/sign-verify-boot-flag; +/usr/bin/echo -n "$$" > /run/sign-verify-boot-flag; echo "[*] Preparing to verify!"; echo "[-] Missing Signatures:"; ec=0; diff --git a/share-pulseaudio-alsa-mixer-profile-sets/default.pa.append b/share-pulseaudio-alsa-mixer-profile-sets/default.pa.append new file mode 100644 index 0000000..0319041 --- /dev/null +++ b/share-pulseaudio-alsa-mixer-profile-sets/default.pa.append @@ -0,0 +1,5 @@ +#CALM DEF +[Profile output:analog-stereo+output:hdmi-stereo+input:analog-stereo] +description = Computer HDMI Output and Computer Input +output-mappings = analog-stereo hdmi-stereo +input-mappings = analog-stereo