From c69300dbe4c0780d6a5ef321b72959168326afc3 Mon Sep 17 00:00:00 2001 From: Gabubu <88589756+GabubuAvailable@users.noreply.github.com> Date: Sun, 10 Apr 2022 09:24:42 +0000 Subject: [PATCH 1/7] modified module_alsa to module_vol + Modified the module name + Added PulseAudio volume (need to notify the user to un-comment one of these 2 lines, depending on what he uses) --- modules.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules.sh b/modules.sh index de2d411..d8c58ed 100755 --- a/modules.sh +++ b/modules.sh @@ -22,8 +22,12 @@ module_user() { export bar="${bar}${1}$(whoami)@$(cat /proc/sys/kernel/hostname)${2}" } -module_alsa() { - export bar="${bar}${1}$(amixer sget Master | awk -F'[][]' '/Mono:/ { print $2 }')${2}" +module_vol() { + # Un-comment this if you use ALSA + #export bar="${bar}${1}$(amixer sget Master | awk -F'[][]' '/Mono:/ { print $2 }')${2}" + + # Un-comment this if you use PulseAudio + #export bar="${bar}${1}$(pamixer --get-volume)${2}" } module_kernel() { From f6b13ea8c076431eda05115dcd032e5fefcaec91 Mon Sep 17 00:00:00 2001 From: Gabubu <88589756+GabubuAvailable@users.noreply.github.com> Date: Sun, 10 Apr 2022 09:25:26 +0000 Subject: [PATCH 2/7] modified module_alsa to module_vol --- config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.sh b/config.sh index 8d885b1..96230b0 100755 --- a/config.sh +++ b/config.sh @@ -18,7 +18,7 @@ export maildir="" #module_uptime "Up: " " | " #module_ram "RAM: " " | " #module_user "User: " " | " -#module_alsa "Vol: " " | " +#module_vol "Vol: " "% | " #module_kernel "Kernel: " " | " #module_loadavg "Load Avg.: " " | " #module_weather "Weather: " " | " From 03a90f57e3f72e1dad80396f0239c1dde2f69eee Mon Sep 17 00:00:00 2001 From: Gabubu <88589756+GabubuAvailable@users.noreply.github.com> Date: Sun, 10 Apr 2022 09:29:53 +0000 Subject: [PATCH 3/7] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 1d2c8a8..c0d0b86 100644 --- a/README.md +++ b/README.md @@ -32,3 +32,8 @@ precmd() { export CSI=$'\e'"[" export PROMPT="${CSI}s${CSI}1;$((LINES-1))r${CSI}$LINES;1f%S%1v%s${CSI}K${CSI}u${PROMPT}" ``` + +## troubleshooting +1) It doesn't show the volume percent. + + Make sure to un-comment one of these 2 lines from modules.sh + ![example](https://user-images.githubusercontent.com/88589756/162611795-75e8ccdd-e9a9-4994-98ea-dd57e26d1121.png) From 029d0c99c7bd8e400fcf5a2f4459ec05bafcbb0a Mon Sep 17 00:00:00 2001 From: Gabubu <88589756+GabubuAvailable@users.noreply.github.com> Date: Sun, 10 Apr 2022 09:49:34 +0000 Subject: [PATCH 4/7] Update README.md --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index c0d0b86..a7e70e6 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,3 @@ export CSI=$'\e'"[" export PROMPT="${CSI}s${CSI}1;$((LINES-1))r${CSI}$LINES;1f%S%1v%s${CSI}K${CSI}u${PROMPT}" ``` -## troubleshooting -1) It doesn't show the volume percent. - + Make sure to un-comment one of these 2 lines from modules.sh - ![example](https://user-images.githubusercontent.com/88589756/162611795-75e8ccdd-e9a9-4994-98ea-dd57e26d1121.png) From 8383207c0fbbc6eea0634baa0256b2a4f4c9d06a Mon Sep 17 00:00:00 2001 From: Gabubu <88589756+GabubuAvailable@users.noreply.github.com> Date: Sun, 10 Apr 2022 09:50:10 +0000 Subject: [PATCH 5/7] Update modules.sh --- modules.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/modules.sh b/modules.sh index d8c58ed..0c651ee 100755 --- a/modules.sh +++ b/modules.sh @@ -23,11 +23,7 @@ module_user() { } module_vol() { - # Un-comment this if you use ALSA - #export bar="${bar}${1}$(amixer sget Master | awk -F'[][]' '/Mono:/ { print $2 }')${2}" - - # Un-comment this if you use PulseAudio - #export bar="${bar}${1}$(pamixer --get-volume)${2}" + export bar="${bar}${1}$(if command -v pamixer > NULL; then pamixer --get-volume; else amixer sget Master | awk -F'[][]' '/Mono:/ { print $2 }'; fi)${2}" } module_kernel() { From 1f70822e40ca6c624e66bec06fa07d6cf2892fa1 Mon Sep 17 00:00:00 2001 From: Gabubu <88589756+GabubuAvailable@users.noreply.github.com> Date: Tue, 12 Apr 2022 16:41:17 +0000 Subject: [PATCH 6/7] added module_mic (sadly uses only pulseaudio) --- modules.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules.sh b/modules.sh index 0c651ee..e84fdfc 100755 --- a/modules.sh +++ b/modules.sh @@ -26,6 +26,10 @@ module_vol() { export bar="${bar}${1}$(if command -v pamixer > NULL; then pamixer --get-volume; else amixer sget Master | awk -F'[][]' '/Mono:/ { print $2 }'; fi)${2}" } +module_mic() { + export bar="${bar}${1}$(if pamixer --source 1 --get-mute | grep -q 'true'; then echo "OFF"; else echo "ON"; fi)${2}" +} + module_kernel() { export bar="${bar}${1}$(sed "s/version // ; s/ (.*//" /proc/version)${2}" } From 2e4d1c6fbfe438494ec66779c6ecfc8cccc7164e Mon Sep 17 00:00:00 2001 From: Gabubu <88589756+GabubuAvailable@users.noreply.github.com> Date: Tue, 12 Apr 2022 16:44:05 +0000 Subject: [PATCH 7/7] Update modules.sh --- modules.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/modules.sh b/modules.sh index e84fdfc..73de0db 100755 --- a/modules.sh +++ b/modules.sh @@ -22,11 +22,15 @@ module_user() { export bar="${bar}${1}$(whoami)@$(cat /proc/sys/kernel/hostname)${2}" } -module_vol() { - export bar="${bar}${1}$(if command -v pamixer > NULL; then pamixer --get-volume; else amixer sget Master | awk -F'[][]' '/Mono:/ { print $2 }'; fi)${2}" +module_vol_pa() { + export bar="${bar}${1}$(pamixer --get-volume)${2}" } -module_mic() { +module_vol_alsa() { + export bar="${bar}${1}$(amixer sget Master | awk -F'[][]' '/Mono:/ { print $2 }')${2}" +} + +module_mic_pa() { export bar="${bar}${1}$(if pamixer --source 1 --get-mute | grep -q 'true'; then echo "OFF"; else echo "ON"; fi)${2}" }