Switching to built-in qtile's notification system.

This commit is contained in:
Bartek Stalewski 2022-11-06 16:27:52 +01:00
parent 58e39e049a
commit f340ed7c15
5 changed files with 10 additions and 6 deletions

View file

@ -28,7 +28,7 @@ set_input() {
set_bt_profile() { set_bt_profile() {
bt_sink=$(pactl list cards | awk -F'"' '/device.name.*bluez/ {print $2}') bt_sink=$(pactl list cards | awk -F'"' '/device.name.*bluez/ {print $2}')
[ -z "${bt_sink}" ] && [ -z "${bt_sink}" ] &&
{ dunstify -u critical "ﳌ no headphones connected"; exit; } { notify-send -t 2000 -u critical "ﳌ no headphones connected"; exit; }
profile_chosen=$(printf "profile mSBC\\nprofile LDAC\\n$div\\nback\\nexit" | dmenu -c -l 5 -i) profile_chosen=$(printf "profile mSBC\\nprofile LDAC\\n$div\\nback\\nexit" | dmenu -c -l 5 -i)
case "$profile_chosen" in case "$profile_chosen" in
back) show_current ;; back) show_current ;;
@ -47,7 +47,7 @@ show_current() {
chosen=$(printf "Output: $def_snk\\nInput: $def_src" | dmenu -c -l 2) chosen=$(printf "Output: $def_snk\\nInput: $def_src" | dmenu -c -l 2)
if [ "$1" = "no_switch" ]; then if [ "$1" = "no_switch" ]; then
case "$chosen" in case "$chosen" in
*) dunstify -u critical "婢 no device to switch" ;; *) notify-send -u critical "婢 no device to switch" ;;
esac esac
else else
case "$chosen" in case "$chosen" in

View file

@ -40,7 +40,7 @@ onescreen() {
postrun() { postrun() {
feh --no-fehbg --bg-scale ~/.local/share/wallpaper.jpg feh --no-fehbg --bg-scale ~/.local/share/wallpaper.jpg
{ killall dunst ; setsid -f dunst ;} >/dev/null 2>&1 # Restart dunst to ensure proper location on screen #{ killall dunst ; setsid -f dunst ;} >/dev/null 2>&1 # Restart dunst to ensure proper location on screen
} }
# Get all possible displays # Get all possible displays
@ -51,7 +51,7 @@ screens=$(echo "$allposs" | awk '/ connected/ {print $1}')
# If there's only one screen # If there's only one screen
[ "$(echo "$screens" | wc -l)" -lt 2 ] && [ "$(echo "$screens" | wc -l)" -lt 2 ] &&
{ onescreen "$screens" "native"; postrun; dunstify -u critical ' no device to switch'; exit ;} { onescreen "$screens" "native"; postrun; notify-send -u critical ' no device to switch'; exit ;}
# Get user choice including both and manual selection: # Get user choice including both and manual selection:
chosen=$(printf -- "%s\\nmulti" "$screens" | dmenu -c -l 5 -i -p "select output") && chosen=$(printf -- "%s\\nmulti" "$screens" | dmenu -c -l 5 -i -p "select output") &&

View file

@ -7,5 +7,5 @@ if [ -n "$1" ]; then
xdotool type "$chosen" xdotool type "$chosen"
else else
printf "$chosen" | xclip -rmlastnl printf "$chosen" | xclip -rmlastnl
dunstify "'$chosen' copied to clipboard" & notify-send "'$chosen' copied to clipboard" &
fi fi

View file

@ -6,7 +6,7 @@ if [ $1 ]; then
dec) pactl set-sink-volume @DEFAULT_SINK@ -5%;; dec) pactl set-sink-volume @DEFAULT_SINK@ -5%;;
esac esac
volume=$(pactl get-sink-volume @DEFAULT_SINK@ | head -n 1 | awk -F' / *' '{print $2}') volume=$(pactl get-sink-volume @DEFAULT_SINK@ | head -n 1 | awk -F' / *' '{print $2}')
dunstify -u low -h int:value:$volume -r 20 -t 800 "volume: $volume" notify-send -u low "volume: $volume"
else else
mic=$(pactl get-source-volume @DEFAULT_SOURCE@ | awk -F' / ' '{print $2}' | tr -d '%') mic=$(pactl get-source-volume @DEFAULT_SOURCE@ | awk -F' / ' '{print $2}' | tr -d '%')
[ $(pactl get-source-mute @DEFAULT_SOURCE@ | awk -F': ' '{print $2}') = yes ] || [ "$mic" -eq 0 ] && micmute="\uf131" || micmute="" [ $(pactl get-source-mute @DEFAULT_SOURCE@ | awk -F': ' '{print $2}') = yes ] || [ "$mic" -eq 0 ] && micmute="\uf131" || micmute=""

View file

@ -134,6 +134,10 @@ screens = [
update_interval=0.5, update_interval=0.5,
cmd="sb-yubikey", cmd="sb-yubikey",
), ),
widget.Spacer(),
widget.Notify(
default_timeout=2,
),
widget.GenPollCommand( widget.GenPollCommand(
background='#005577', background='#005577',
foreground='#ffffff', foreground='#ffffff',