diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2024-09-06 10:34:05 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2024-09-06 10:34:05 +0800 |
| commit | 01abbff07781d55101f5a347634de49631709579 (patch) | |
| tree | 6069e2ea6e007ff932cdfa917d922b9b1c186230 /hyprindicator | |
| parent | 582c7ad0569e4bc52a86b38e9a51f07f41842e15 (diff) | |
more hyprland scripts
Diffstat (limited to 'hyprindicator')
| -rwxr-xr-x | hyprindicator | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/hyprindicator b/hyprindicator new file mode 100755 index 0000000..46f4753 --- /dev/null +++ b/hyprindicator @@ -0,0 +1,44 @@ +#!/bin/bash + +function Mic { + # inotifywait -e modify /proc/asound/card0/pcm0c/sub0/status # doesnt work :( + rawMicStatus=$(cat /proc/asound/card0/pcm0c/sub0/status) + if [[ $rawMicStatus == *"closed"* ]]; then + # echo "Mic is closed" + unset micpid + return 1 + else + micpid=$(printf "%s" "$rawMicStatus" | grep 'owner_pid' | awk -F ': ' '{print $2}') + fi +} + +function Camera { + campid=$(fuser "/dev/video0" 2>/dev/null) || unset campid + # icampid=$(fuser "/dev/video2" 2>/dev/null) # IR camera + if [ $campid ]; then + unset campid + else + return 1 + fi +} + +function subscribe { + while true; do + Mic + Camera + if [ ! $micpid ] && [ ! $campid ]; then + echo '{"text": " ", "tooltip": " ", "class": "no"}' + elif [ $micpid ] && [ ! $campid ]; then + echo '{"text": "", "tooltip": "Mic: '$micpid'", "class": "mic"}' + elif [ ! $micpid ] && [ $campid ]; then + echo '{"text": "", "tooltip": "Camera: '$campid'", "class": "cam"}' + else + echo '{"text": " ", "tooltip": "Mic: '$micpid' Camera: '$campid'", "class": "miccam}' + fi + sleep 1 + done +} + +if [ "$1" ]; then + $@ +fi |
