+ Added scripts directory
This commit is contained in:
parent
c42020a930
commit
08332199a2
23 changed files with 547 additions and 0 deletions
59
.scripts/volume.sh
Executable file
59
.scripts/volume.sh
Executable file
|
@ -0,0 +1,59 @@
|
|||
#!/bin/bash
|
||||
|
||||
## Author : Aditya Shakya (adi1090x)
|
||||
## Mail : adi1090x@gmail.com
|
||||
## Github : @adi1090x
|
||||
## Reddit : @adi1090x
|
||||
|
||||
rofi_command="rofi -theme $HOME/.config/rofi/theme/Android/three.rasi"
|
||||
|
||||
## Get Volume
|
||||
#VOLUME=$(amixer get Master | tail -n 1 | awk -F ' ' '{print $5}' | tr -d '[]%')
|
||||
MUTE=$(amixer get Master | tail -n 1 | awk -F ' ' '{print $6}' | tr -d '[]%')
|
||||
|
||||
active=""
|
||||
urgent=""
|
||||
|
||||
if [[ $MUTE == *"off"* ]]; then
|
||||
active="-a 1"
|
||||
else
|
||||
urgent="-u 1"
|
||||
fi
|
||||
|
||||
if [[ $MUTE == *"off"* ]]; then
|
||||
active="-a 1"
|
||||
else
|
||||
urgent="-u 1"
|
||||
fi
|
||||
|
||||
if [[ $MUTE == *"on"* ]]; then
|
||||
VOLUME="$(amixer get Master | tail -n 1 | awk -F ' ' '{print $5}' | tr -d '[]%')%"
|
||||
else
|
||||
VOLUME="Mu..."
|
||||
fi
|
||||
|
||||
## Icons
|
||||
ICON_UP=""
|
||||
ICON_DOWN=""
|
||||
ICON_MUTED=""
|
||||
|
||||
options="$ICON_UP\n$ICON_MUTED\n$ICON_DOWN"
|
||||
|
||||
## Main
|
||||
chosen="$(echo -e "$options" | $rofi_command -p "$VOLUME" -dmenu $active $urgent -selected-row 0)"
|
||||
case $chosen in
|
||||
$ICON_UP)
|
||||
amixer -Mq set Master,0 5%+ unmute && notify-send -u low -t 1500 "Volume Up $ICON_UP"
|
||||
sh $HOME/.scripts/volume.sh
|
||||
;;
|
||||
$ICON_DOWN)
|
||||
amixer -Mq set Master,0 5%- unmute && notify-send -u low -t 1500 "Volume Down $ICON_DOWN"
|
||||
sh $HOME/.scripts/volume.sh
|
||||
;;
|
||||
$ICON_MUTED)
|
||||
amixer -q set Master toggle
|
||||
sh $HOME/.scripts/volume.sh
|
||||
;;
|
||||
esac
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue