From c3157fd295bfb41e74379549920c05951e1784e7 Mon Sep 17 00:00:00 2001 From: Saumit Dinesan Date: Fri, 19 Aug 2022 18:52:26 +0530 Subject: script changes + wal template icon path update --- .scripts/battery | 2 +- .scripts/bts | 19 ++++++++++++------- .scripts/cpu | 12 +----------- .scripts/memory | 2 +- .scripts/setbg | 2 +- 5 files changed, 16 insertions(+), 21 deletions(-) (limited to '.scripts') diff --git a/.scripts/battery b/.scripts/battery index 626c517..4ff2318 100755 --- a/.scripts/battery +++ b/.scripts/battery @@ -26,7 +26,7 @@ for battery in /sys/class/power_supply/BAT?*; do "Discharging") status="🔋" ;; "Charging") status="🔌" ;; "Not charging") status="🛑" ;; - "Unknown") status="♻️ " ;; + "Unknown") status="🟢" ;; *) exit 1 ;; esac capacity="$(cat "$battery/capacity" 2>&1)" diff --git a/.scripts/bts b/.scripts/bts index 014444f..d0d03dd 100755 --- a/.scripts/bts +++ b/.scripts/bts @@ -1,12 +1,14 @@ #!/bin/bash -option=$(echo -e "Connect\nDisconnect\nChange profile"| dmenu -p "Do you wish to connect/disconnect or change soundprofile of your bluetooth device:") -MAC=$(echo "76:67:11:36:64:A2") +option=$(echo -e "Connect\nDisconnect\nChange profile\nReset pulseaudio"| dmenu -p "Do you wish to connect/disconnect or change soundprofile of your bluetooth device:") +#Prereq: trust the MAC address +#MAC="11:11:22:ED:08:AD" +MAC="76:67:11:36:64:A2" case $option in "Connect") status=$(systemctl status bluetooth | grep Active | cut -d " " -f 7) case $status in - "active") - bluetoothctl power on + "active") + bluetoothctl power on && bluetoothctl connect $MAC && sleep 2 && [ $(bluetoothctl info $MAC|grep "Connected"|awk -F'[:][ ]' '/^[^#]/{print $2}') == "yes" ] && notify-send "Connected" "Bluetooth Device is connected" || notify-send "Unable to connect!" "Check whether the bluetooth device is switched on.";; "inactive" | "failed") @@ -14,12 +16,12 @@ case $option in #st -e sudo systemctl start bluetooth && notify-send "Bluetooth daemon is running" bluetoothctl power on - bluetoothctl connect $MAC && sleep 1 && [ $(bluetoothctl info $MAC|grep "Connected"|awk -F'[:][ ]' '/^[^#]/{print $2}') == "yes" ] && notify-send "Connected" "Bluetooth Device is disconnected" || notify-send "Unable to connect!" "Check whether the bluetooth device is switched on."; + bluetoothctl connect $MAC && sleep 1 && [ $(bluetoothctl info $MAC|grep "Connected"|awk -F'[:][ ]' '/^[^#]/{print $2}') == "yes" ] && notify-send "Connected" "Bluetooth Device is connected" || notify-send "Unable to connect!" "Check whether the bluetooth device is switched on."; esac;; "Disconnect") bluetoothctl power off && sudo -A systemctl stop bluetooth - notify-send "Disconnected" "Bluetooth Device is connected" || notify-send "Unable to connect!" "Check whether the bluetooth device is switched on.";; + notify-send "Disconnected" "Bluetooth Device is disconnected" || notify-send "Unable to disconnect!" ;; "Change profile") past_profile=$(pactl list | grep "Active Profile" | sed '2p;d' | cut -d ' ' -f 3) @@ -33,5 +35,8 @@ case $option in "handsfree_head_unit(inferior audio output + mic enable)") pactl set-card-profile $cardindex handsfree_head_unit notify-send "Switched card profile from $past_profile to $profile" -i audio-headset;; - esac + esac;; + "Reset pulseaudio") + ##check for a2dp sink not found error in status command + pulseaudio --kill && pulseaudio --cleanup-shm && pulseaudio --start;; esac diff --git a/.scripts/cpu b/.scripts/cpu index 1572b52..af63fc3 100755 --- a/.scripts/cpu +++ b/.scripts/cpu @@ -1,12 +1,2 @@ #!/bin/sh - -case $BLOCK_BUTTON in - 1) notify-send "🖥 CPU hogs" "$(ps axch -o cmd:15,%cpu --sort=-%cpu | head)\\n(100% per core)" ;; - 2) setsid -f "$TERMINAL" -e htop ;; - 3) notify-send "🖥 CPU module " "\- Shows CPU temperature. -- Click to show intensive processes. -- Middle click to open htop." ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -sensors | awk '/Core 0/ {print "🌡" $3}' +cat /proc/stat | grep cpu | head -1 | awk '{print ($5*100)/($2+$3+$4+$5+$6+$7+$8+$9+$10+$11)}'| awk '{printf (" %2.1f%",(100-$1))}' diff --git a/.scripts/memory b/.scripts/memory index 56a236c..6a8fe0b 100755 --- a/.scripts/memory +++ b/.scripts/memory @@ -9,4 +9,4 @@ case $BLOCK_BUTTON in 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac -free --mebi | sed -n '2{p;q}' | awk '{printf ("🧠%2.1fGB/16GB\n", ( $3 / 1024), ($2 / 1024))}' +free --mebi | sed -n '2{p;q}' | awk '{printf ("🧠%2.1fGB/16GB\n", ( $3 / 1024))}' diff --git a/.scripts/setbg b/.scripts/setbg index 024f28d..f7a4e95 100755 --- a/.scripts/setbg +++ b/.scripts/setbg @@ -17,5 +17,5 @@ xdotool key super+F5 $HOME/.local/usr/wal-telegram/wal-telegram ln -sf ~/.cache/wal/dunstrc ~/.config/dunst/dunstrc pkill dunst && -dunst +dunst > /dev/null & echo "^_^ Enjoy your new look!!!" -- cgit v1.2.3