Changes in: bin,dunst,gtk-3.0,gtk-4.0,hypr,waybar,
This commit is contained in:
parent
9920450b17
commit
50cc31d4e1
43 changed files with 2807 additions and 215 deletions
|
@ -1,22 +1,52 @@
|
|||
#!/bin/sh
|
||||
# #!/bin/bash
|
||||
# # I copied this script from JaKooLit. https://github.com/JaKooLit. Because I do not have any laptop to test these kinds of features.
|
||||
|
||||
# Use brightnessctl to naturally adjust laptop screen brightness and send a notification
|
||||
iDIR="$HOME/.config/dunst/icons/brightness"
|
||||
notification_timeout=1000
|
||||
|
||||
currentbrightness=$(brightnessctl -e4 -m | awk -F, '{print substr($4, 0, length($4)-1)}')
|
||||
if [ "$currentbrightness" -lt 30 ] && [ "$1" = "down" ]; then exit 1; fi
|
||||
|
||||
send_notification() {
|
||||
brightness=$(brightnessctl -e4 -m | awk -F, '{print substr($4, 0, length($4)-1)}')
|
||||
dunstify -a "Backlight" -u critical -h int:value:"$brightness" -i "brightness" "Brightness" -t 1000
|
||||
# Get brightness
|
||||
get_backlight() {
|
||||
echo $(brightnessctl -m | cut -d, -f4)
|
||||
}
|
||||
|
||||
case $1 in
|
||||
up)
|
||||
brightnessctl -e4 set 1%+
|
||||
send_notification "$1"
|
||||
# Get icons
|
||||
get_icon() {
|
||||
current=$(get_backlight | sed 's/%//')
|
||||
if [ "$current" -le "20" ]; then
|
||||
icon="$iDIR/brightness-20.png"
|
||||
elif [ "$current" -le "40" ]; then
|
||||
icon="$iDIR/brightness-40.png"
|
||||
elif [ "$current" -le "60" ]; then
|
||||
icon="$iDIR/brightness-60.png"
|
||||
elif [ "$current" -le "80" ]; then
|
||||
icon="$iDIR/brightness-80.png"
|
||||
else
|
||||
icon="$iDIR/brightness-100.png"
|
||||
fi
|
||||
}
|
||||
|
||||
# Notify
|
||||
notify_user() {
|
||||
notify-send -e -h string:x-canonical-private-synchronous:brightness_notif -h int:value:$current -u low -i "$icon" "Brightness : $current%"
|
||||
}
|
||||
|
||||
# Change brightness
|
||||
change_backlight() {
|
||||
brightnessctl set "$1" -n && get_icon && notify_user
|
||||
}
|
||||
|
||||
# Execute accordingly
|
||||
case "$1" in
|
||||
"--get")
|
||||
get_backlight
|
||||
;;
|
||||
down)
|
||||
brightnessctl -e4 set 1%-
|
||||
send_notification "$1"
|
||||
"up")
|
||||
change_backlight "+10%"
|
||||
;;
|
||||
"down")
|
||||
change_backlight "10%-"
|
||||
;;
|
||||
*)
|
||||
get_backlight
|
||||
;;
|
||||
esac
|
||||
|
|
217
bin/volume.sh
217
bin/volume.sh
|
@ -1,55 +1,170 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
iDIR="$HOME/.config/dunst/icons/vol"
|
||||
|
||||
case $1 in
|
||||
up)
|
||||
wpctl set-mute @DEFAULT_AUDIO_SINK@ 0
|
||||
wpctl set-volume -l 2.0 @DEFAULT_AUDIO_SINK@ 2%+
|
||||
;;
|
||||
down)
|
||||
wpctl set-mute @DEFAULT_AUDIO_SINK@ 0
|
||||
wpctl set-volume -l 2.0 @DEFAULT_AUDIO_SINK@ 2%-
|
||||
;;
|
||||
mute)
|
||||
wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {up|down|mute}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
VOLUME=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{print int($2 * 100)}')
|
||||
|
||||
NORMALIZED_VOLUME=$((VOLUME / 2))
|
||||
|
||||
send_notification() {
|
||||
# if [ "$1" = "mute" ]; then
|
||||
# ICON='' # Mute icon
|
||||
# MSG="Muted"
|
||||
# elif [ "$NORMALIZED_VOLUME" -lt 50 ]; then
|
||||
# ICON='' # Low volume icon
|
||||
# MSG="Volume: $NORMALIZED_VOLUME%"
|
||||
# elif [ "$NORMALIZED_VOLUME" -lt 90 ]; then
|
||||
# ICON='' # Medium volume icon
|
||||
# MSG="Volume: $NORMALIZED_VOLUME%"
|
||||
# else
|
||||
# ICON='' # High volume icon
|
||||
# MSG="Volume: $NORMALIZED_VOLUME%"
|
||||
# fi
|
||||
|
||||
dunstify -u normal -h "int:value:$NORMALIZED_VOLUME" -a "Volume" "Volume" -t 2000
|
||||
# Get Volume
|
||||
get_volume() {
|
||||
volume=$(pamixer --get-volume)
|
||||
if [[ "$volume" -eq "0" ]]; then
|
||||
echo "Muted"
|
||||
else
|
||||
echo "$volume%"
|
||||
fi
|
||||
}
|
||||
|
||||
case $1 in
|
||||
mute)
|
||||
if wpctl get-volume @DEFAULT_AUDIO_SINK@ | grep -q "MUTED"; then
|
||||
send_notification mute
|
||||
else
|
||||
send_notification
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
send_notification
|
||||
;;
|
||||
esac
|
||||
# Get icons
|
||||
get_icon() {
|
||||
current=$(get_volume)
|
||||
if [[ "$current" == "Muted" ]]; then
|
||||
echo "$iDIR/muted-speaker.svg"
|
||||
elif [[ "${current%\%}" = 5 ]]; then
|
||||
echo "$iDIR/vol-5.svg"
|
||||
elif [[ "${current%\%}" = 10 ]]; then
|
||||
echo "$iDIR/vol-10.svg"
|
||||
elif [[ "${current%\%}" = 15 ]]; then
|
||||
echo "$iDIR/vol-15.svg"
|
||||
elif [[ "${current%\%}" = 20 ]]; then
|
||||
echo "$iDIR/vol-20.svg"
|
||||
elif [[ "${current%\%}" = 25 ]]; then
|
||||
echo "$iDIR/vol-25.svg"
|
||||
elif [[ "${current%\%}" = 30 ]]; then
|
||||
echo "$iDIR/vol-30.svg"
|
||||
elif [[ "${current%\%}" = 35 ]]; then
|
||||
echo "$iDIR/vol-35.svg"
|
||||
elif [[ "${current%\%}" = 40 ]]; then
|
||||
echo "$iDIR/vol-40.svg"
|
||||
elif [[ "${current%\%}" = 45 ]]; then
|
||||
echo "$iDIR/vol-45.svg"
|
||||
elif [[ "${current%\%}" = 50 ]]; then
|
||||
echo "$iDIR/vol-50.svg"
|
||||
elif [[ "${current%\%}" = 55 ]]; then
|
||||
echo "$iDIR/vol-55.svg"
|
||||
elif [[ "${current%\%}" = 60 ]]; then
|
||||
echo "$iDIR/vol-60.svg"
|
||||
elif [[ "${current%\%}" = 65 ]]; then
|
||||
echo "$iDIR/vol-65.svg"
|
||||
elif [[ "${current%\%}" = 70 ]]; then
|
||||
echo "$iDIR/vol-70.svg"
|
||||
elif [[ "${current%\%}" = 75 ]]; then
|
||||
echo "$iDIR/vol-75.svg"
|
||||
elif [[ "${current%\%}" = 80 ]]; then
|
||||
echo "$iDIR/vol-80.svg"
|
||||
elif [[ "${current%\%}" = 85 ]]; then
|
||||
echo "$iDIR/vol-85.svg"
|
||||
elif [[ "${current%\%}" = 90 ]]; then
|
||||
echo "$iDIR/vol-90.svg"
|
||||
elif [[ "${current%\%}" = 95 ]]; then
|
||||
echo "$iDIR/vol-95.svg"
|
||||
else
|
||||
echo "$iDIR/vol-100.svg"
|
||||
fi
|
||||
}
|
||||
|
||||
# Notify
|
||||
notify_user() {
|
||||
if [[ "$(get_volume)" == " " ]]; then
|
||||
notify-send -a -r -h string:x-dunst-stack-tag:volume_notif -i "$(get_icon)" "Volume: Muted"
|
||||
else
|
||||
notify-send -a -r -h string:x-dunst-stack-tag:volume_notif -i "$(get_icon)" "Volume: $(get_volume)"
|
||||
fi
|
||||
}
|
||||
|
||||
# Increase Volume
|
||||
inc_volume() {
|
||||
if [ "$(pamixer --get-mute)" == "true" ]; then
|
||||
pamixer -u && notify_user
|
||||
fi
|
||||
pamixer -i 5 && notify_user
|
||||
}
|
||||
|
||||
# Decrease Volume
|
||||
dec_volume() {
|
||||
if [ "$(pamixer --get-mute)" == "true" ]; then
|
||||
pamixer -u && notify_user
|
||||
fi
|
||||
pamixer -d 5 && notify_user
|
||||
}
|
||||
|
||||
# Toggle Mute
|
||||
toggle_mute() {
|
||||
if [ "$(pamixer --get-mute)" == "false" ]; then
|
||||
pamixer -m && notify-send -a -h -i "$iDIR/muted-speaker.svg" "Volume Switched OFF"
|
||||
elif [ "$(pamixer --get-mute)" == "true" ]; then
|
||||
pamixer -u && notify-send -a -h -i "$iDIR/unmuted-speaker.svg" "Volume Switched ON"
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggle Mic
|
||||
toggle_mic() {
|
||||
if [ "$(pamixer --default-source --get-mute)" == "false" ]; then
|
||||
pamixer --default-source -m && notify-send -e -u low -i "$iDIR/muted-mic.svg" "Microphone Switched OFF"
|
||||
elif [ "$(pamixer --default-source --get-mute)" == "true" ]; then
|
||||
pamixer --default-source -u && notify-send -e -u low -i "$iDIR/unmuted-mic.svg" "Microphone Switched ON"
|
||||
fi
|
||||
}
|
||||
|
||||
# Get Mic Icon
|
||||
get_mic_icon() {
|
||||
current=$(pamixer --default-source --get-volume)
|
||||
if [[ "$current" -eq "0" ]]; then
|
||||
echo "$iDIR/muted-mic.svg"
|
||||
else
|
||||
echo "$iDIR/unmuted-mic.svg"
|
||||
fi
|
||||
}
|
||||
|
||||
# Get Microphone Volume
|
||||
get_mic_volume() {
|
||||
volume=$(pamixer --default-source --get-volume)
|
||||
if [[ "$volume" -eq "0" ]]; then
|
||||
echo "Muted"
|
||||
else
|
||||
echo "$volume%"
|
||||
fi
|
||||
}
|
||||
|
||||
# Notify for Microphone
|
||||
notify_mic_user() {
|
||||
volume=$(get_mic_volume)
|
||||
icon=$(get_mic_icon)
|
||||
notify-send -a -r 91190 -t 800 -i "$icon" "Mic=vel: $volume"
|
||||
}
|
||||
|
||||
# Increase MIC Volume
|
||||
inc_mic_volume() {
|
||||
if [ "$(pamixer --default-source --get-mute)" == "true" ]; then
|
||||
pamixer --default-source -u && notify_mic_user
|
||||
fi
|
||||
pamixer --default-source -i 5 && notify_mic_user
|
||||
}
|
||||
|
||||
# Decrease MIC Volume
|
||||
dec_mic_volume() {
|
||||
if [ "$(pamixer --default-source --get-mute)" == "true" ]; then
|
||||
pamixer --default-source -u && notify_mic_user
|
||||
fi
|
||||
pamixer --default-source -d 5 && notify_mic_user
|
||||
}
|
||||
|
||||
# Execute accordingly
|
||||
if [[ "$1" == "--get" ]]; then
|
||||
get_volume
|
||||
elif [[ "$1" == "--inc" ]]; then
|
||||
inc_volume
|
||||
elif [[ "$1" == "--dec" ]]; then
|
||||
dec_volume
|
||||
elif [[ "$1" == "--toggle" ]]; then
|
||||
toggle_mute
|
||||
elif [[ "$1" == "--toggle-mic" ]]; then
|
||||
toggle_mic
|
||||
elif [[ "$1" == "--get-icon" ]]; then
|
||||
get_icon
|
||||
elif [[ "$1" == "--get-mic-icon" ]]; then
|
||||
get_mic_icon
|
||||
elif [[ "$1" == "--mic-inc" ]]; then
|
||||
inc_mic_volume
|
||||
elif [[ "$1" == "--mic-dec" ]]; then
|
||||
dec_mic_volume
|
||||
else
|
||||
get_volume
|
||||
fi
|
||||
|
|
55
bin/volume_bak.sh
Executable file
55
bin/volume_bak.sh
Executable file
|
@ -0,0 +1,55 @@
|
|||
#!/bin/sh
|
||||
|
||||
|
||||
case $1 in
|
||||
up)
|
||||
wpctl set-mute @DEFAULT_AUDIO_SINK@ 0
|
||||
wpctl set-volume -l 2.0 @DEFAULT_AUDIO_SINK@ 2%+
|
||||
;;
|
||||
down)
|
||||
wpctl set-mute @DEFAULT_AUDIO_SINK@ 0
|
||||
wpctl set-volume -l 2.0 @DEFAULT_AUDIO_SINK@ 2%-
|
||||
;;
|
||||
mute)
|
||||
wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {up|down|mute}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
VOLUME=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{print int($2 * 100)}')
|
||||
|
||||
NORMALIZED_VOLUME=$((VOLUME / 2))
|
||||
|
||||
send_notification() {
|
||||
# if [ "$1" = "mute" ]; then
|
||||
# ICON='' # Mute icon
|
||||
# MSG="Muted"
|
||||
# elif [ "$NORMALIZED_VOLUME" -lt 50 ]; then
|
||||
# ICON='' # Low volume icon
|
||||
# MSG="Volume: $NORMALIZED_VOLUME%"
|
||||
# elif [ "$NORMALIZED_VOLUME" -lt 90 ]; then
|
||||
# ICON='' # Medium volume icon
|
||||
# MSG="Volume: $NORMALIZED_VOLUME%"
|
||||
# else
|
||||
# ICON='' # High volume icon
|
||||
# MSG="Volume: $NORMALIZED_VOLUME%"
|
||||
# fi
|
||||
|
||||
dunstify -u normal -h "int:value:$NORMALIZED_VOLUME" -a "Volume" "Volume" -t 2000
|
||||
}
|
||||
|
||||
case $1 in
|
||||
mute)
|
||||
if wpctl get-volume @DEFAULT_AUDIO_SINK@ | grep -q "MUTED"; then
|
||||
send_notification mute
|
||||
else
|
||||
send_notification
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
send_notification
|
||||
;;
|
||||
esac
|
Loading…
Add table
Add a link
Reference in a new issue