Dunst add progress bar support and new colors
This commit is contained in:
parent
997d091fc6
commit
186d3f5e17
@ -2,15 +2,22 @@
|
||||
### Display ###
|
||||
monitor = 0
|
||||
follow = keyboard
|
||||
geometry = "300x5-30+20"
|
||||
width = 400
|
||||
height = 200
|
||||
offset = 30
|
||||
origin = top-right
|
||||
indicate_hidden = yes
|
||||
shrink = no
|
||||
transparency = 20
|
||||
transparency = 10
|
||||
notification_height = 0
|
||||
separator_height = 2
|
||||
padding = 8
|
||||
horizontal_padding = 8
|
||||
frame_width = 3
|
||||
frame_width = 0
|
||||
|
||||
# progress bar
|
||||
progress_bar_max_width = 400
|
||||
progress_bar_min_width = 400
|
||||
|
||||
# Defines color of the frame around the notification window.
|
||||
frame_color = "#808080"
|
||||
@ -20,7 +27,7 @@
|
||||
|
||||
### Text ###
|
||||
|
||||
font = Monospace 8
|
||||
font = FiraCode 12
|
||||
line_height = 0
|
||||
markup = full
|
||||
|
||||
@ -34,7 +41,7 @@
|
||||
# %n progress value if set without any extra characters
|
||||
# %% Literal %
|
||||
# Markup is allowed
|
||||
format = "<tt><b>%s</b>\n%b\n\n<i>%a</i></tt>"
|
||||
format = "%s\n\n%b\n"
|
||||
|
||||
alignment = left
|
||||
show_age_threshold = -1
|
||||
@ -115,12 +122,13 @@
|
||||
[urgency_low]
|
||||
background = "#222222"
|
||||
foreground = "#888888"
|
||||
timeout = 0
|
||||
highlight = "#153EBC"
|
||||
timeout = 3000
|
||||
|
||||
[urgency_normal]
|
||||
background = "#222222"
|
||||
foreground = "#ffffff"
|
||||
timeout = 0
|
||||
timeout = 30000
|
||||
|
||||
[urgency_critical]
|
||||
background = "#900000"
|
||||
|
@ -1,6 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
# https://www.reddit.com/r/suckless/comments/m6r71v/comment/gr7t2z1/?utm_source=reddit&utm_medium=web2x&context=3
|
||||
# source of first version: https://www.reddit.com/r/suckless/comments/m6r71v/comment/gr7t2z1/?utm_source=reddit&utm_medium=web2x&context=3
|
||||
# My changes:
|
||||
# * fixed double notifications for critical level
|
||||
# * added dunst stack tag
|
||||
# * added dunst value for progress bar
|
||||
|
||||
# Control variable
|
||||
# Possible values: NONE, FULL, LOW, CRITICAL
|
||||
@ -21,23 +25,21 @@ while true; do
|
||||
|
||||
# If battery full and not already warned about that
|
||||
if [ "$last" != "FULL" ] && [ "$status" = "Full" ]; then
|
||||
notify-send "Battery full"
|
||||
notify-send -h string:x-dunst-stack-tag:battery_notif -h "int:value:$last" "Battery full"
|
||||
last="FULL"
|
||||
fi
|
||||
|
||||
# If low and discharging
|
||||
if [ "$last" != "LOW" ] && [ "$status" = "Discharging" ] && \
|
||||
[ $capacity -le $low ]; then
|
||||
notify-send "Battery low: $capacity%"
|
||||
if [ "$last" != "LOW" ] && [ "$status" = "Discharging" ] && [ $capacity -le $low ] && [ $capacity -gt $critical ]; then
|
||||
notify-send -h string:x-dunst-stack-tag:battery_notif -h "int:value:$last" "Battery low: $capacity%"
|
||||
last=LOW
|
||||
fi
|
||||
|
||||
# If critical and discharging
|
||||
if [ "$status" = "Discharging" ] && [ $capacity -le $critical ]; then
|
||||
notify-send -u critical "Battery very low: $capacity%"
|
||||
notify-send -h string:x-dunst-stack-tag:battery_notif -h "int:value:$last" -u critical "Battery very low: $capacity%"
|
||||
last=CRITICAL
|
||||
fi
|
||||
fi
|
||||
sleep 60
|
||||
done
|
||||
|
||||
|
@ -3,12 +3,16 @@
|
||||
DEVICE=pulse
|
||||
NAME=Master
|
||||
URGENCY=low
|
||||
EXPIRE=1500
|
||||
EXPIRE=5000
|
||||
|
||||
ALSA_CMD="amixer -D $DEVICE"
|
||||
NOTIFY_CMD="notify-send -u $URGENCY -t $EXPIRE 🔊 "
|
||||
NOTIFY_CMD="notify-send -u $URGENCY -t $EXPIRE VOLUME "
|
||||
|
||||
$ALSA_CMD sset $NAME "$1"
|
||||
LEVEL=$($ALSA_CMD sget $NAME | awk -F"[][]" '/Left:/ { print $2 }')
|
||||
|
||||
$NOTIFY_CMD $LEVEL
|
||||
notify-send -u $URGENCY \
|
||||
-h "int:value:$LEVEL" \
|
||||
-h string:x-dunst-stack-tag:volume_notif \
|
||||
-t $EXPIRE \
|
||||
"VOLUME: $LEVEL"
|
||||
|
Loading…
Reference in New Issue
Block a user