diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-03-14 13:06:07 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-03-14 13:06:07 +0900 |
| commit | f643735fcce89aa029dde2bfc1472fc013f376ac (patch) | |
| tree | f31922a307f78147d9ec8aab5540d4d812bafac8 | |
| parent | 1064b771da600c95e315067c999f63ee0df4c641 (diff) | |
modified shell/aliasrc, modified bin/dmenuconnections, created statusbar/sb-mic
| -rw-r--r-- | ar/.config/shell/aliasrc | 2 | ||||
| -rwxr-xr-x | ar/.local/bin/dmenuconnections | 2 | ||||
| -rwxr-xr-x | ar/.local/bin/statusbar/sb-mic | 54 |
3 files changed, 56 insertions, 2 deletions
diff --git a/ar/.config/shell/aliasrc b/ar/.config/shell/aliasrc index a862e3c..60db400 100644 --- a/ar/.config/shell/aliasrc +++ b/ar/.config/shell/aliasrc @@ -277,7 +277,7 @@ alias p8='ping 8.8.8.8' alias p9='ping 9.9.9.9' # nvim -alias v'"$EDITOR' +alias v='$EDITOR' alias v.='$EDITOR .' alias ve='$EDITOR -c enew' alias nv.='nvim .' diff --git a/ar/.local/bin/dmenuconnections b/ar/.local/bin/dmenuconnections index cf8e9cf..13fe8cc 100755 --- a/ar/.local/bin/dmenuconnections +++ b/ar/.local/bin/dmenuconnections @@ -31,5 +31,5 @@ bluetooth) esac ;; network) networkmanager_dmenu ;; -wifi) nmcli -c no d wifi list | tail -n +2 | sed 's/ \+/ /;s/Infra [0-9]*/ /g;s/WPA. .*$//;s/Mbit\/s[[:space:]]*[0-9]*/Mbit\/s/g;s/Ad-Hoc [0-9]*//g' | dmenu -l 20 -p Networks ;; +wifi) nmcli -c no d wifi list | tail -n +2 | sed 's/ \+/ /;s/Infra [0-9]*/ /g;s/WPA. .*$//;s/Mbit\/s[[:space:]]*[0-9]*/Mbit\/s/g;s/Ad-Hoc [0-9]*//g' | dmenu -i -l 20 -p Networks ;; esac diff --git a/ar/.local/bin/statusbar/sb-mic b/ar/.local/bin/statusbar/sb-mic new file mode 100755 index 0000000..7c5aebc --- /dev/null +++ b/ar/.local/bin/statusbar/sb-mic @@ -0,0 +1,54 @@ +#!/bin/sh + +clean_line() { + echo "$1" | sed -e 's/^[[:space:]│]*//;s/[[:space:]]*$//;s/[[:space:]]*\[vol:.*\]//' +} + +change() { + # Extract Audio Sources (POSIX-compliant) + audio_sources=$(wpctl status | awk ' + /^Audio$/ {audio=1} + /^Video$/ {audio=0} + audio && /^ ├─ Sources:/ {flag=1; next} + flag && /^ ├─ Filters:/ {flag=0} + flag +') + + # Extract default source (marked with '*') and remove '*' + default_source=$(echo "$audio_sources" | awk '/\*/ {sub(/\*/, ""); print}') + default_source=$(clean_line "$default_source") + + # Extract other sources (excluding default) and format them cleanly + other_sources=$(echo "$audio_sources" | grep -v '\*' | while IFS= read -r line; do + clean_line "$line" + done) + + # Combine and let user choose via dmenu + chosen_source=$(printf "%s\n" "$other_sources" | dmenu -i -p "Change default input from \"${default_source#* }\" to:") + + # Extract the ID from the chosen source + chosen_id=$(echo "$chosen_source" | awk '{print $1}') + + # Set the new default input source + if [ -n "$chosen_id" ]; then + wpctl set-default "$chosen_id" + notify-send "Input Source Changed" "Now using: $chosen_source" + fi +} + +if wpctl get-volume @DEFAULT_AUDIO_SOURCE@ 2>/dev/null | grep -q "MUTED"; then + echo "😷" +else + echo "😲" +fi + +case $BLOCK_BUTTON in +1) change ;; +2) wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle ;; +3) + notify-send "🎤 Microphone module" "\- Show current input source +- Left click to change input source +- Middle click to toggle mic" + ;; +6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; +esac |
