From 0cdf6e4723a13ebd2b8fb1ac9754ef6f90456184 Mon Sep 17 00:00:00 2001 From: Miles Alan Date: Wed, 27 May 2020 20:26:55 -0500 Subject: [PATCH] Rework notifications to only use dunst --- configs/dunst.conf | 52 +++++++++++++++++++++++++++++++++ scripts/core/sxmo_appmenu.sh | 2 +- scripts/core/sxmo_brightness.sh | 3 +- scripts/core/sxmo_notify.sh | 12 -------- scripts/core/sxmo_vol.sh | 3 +- scripts/core/sxmo_xinit.sh | 3 +- 6 files changed, 58 insertions(+), 17 deletions(-) create mode 100644 configs/dunst.conf delete mode 100755 scripts/core/sxmo_notify.sh diff --git a/configs/dunst.conf b/configs/dunst.conf new file mode 100644 index 0000000..a7f9323 --- /dev/null +++ b/configs/dunst.conf @@ -0,0 +1,52 @@ +[global] + geometry = "0x5-2+25" + indicate_hidden = yes + shrink = no + notification_height = 0 + separator_height = 2 + padding = 2 + horizontal_padding = 5 + frame_width = 2 + frame_color = "#888888" + sort = yes + idle_threshold = 120 + font = Monospace 16 + markup = full + format = "%s\n%b" + alignment = left + show_age_threshold = 60 + word_wrap = yes + ellipsize = middle + ignore_newline = no + stack_duplicates = true + hide_duplicate_count = false + show_indicators = yes + icon_position = left + max_icon_size = 32 + icon_path = /usr/share/icons/gnome/16x16/status/:/usr/share/icons/gnome/16x16/devices/ + sticky_history = yes + history_length = 20 + dmenu = /usr/bin/dmenu -p dunst: + browser = /usr/bin/firefox -new-tab + always_run_script = true + title = Dunst + class = Dunst + startup_notification = false +[shortcuts] + close_all = ctrl+shift+space + +[urgency_low] + background = "#222222" + foreground = "#888888" + timeout = 2 + +[urgency_normal] + background = "#ffffff" + foreground = "#000000" + timeout = 2 + +[urgency_critical] + background = "#900000" + foreground = "#ffffff" + frame_color = "#ff0000" + timeout = 0 diff --git a/scripts/core/sxmo_appmenu.sh b/scripts/core/sxmo_appmenu.sh index dffb2d0..441b8e1 100755 --- a/scripts/core/sxmo_appmenu.sh +++ b/scripts/core/sxmo_appmenu.sh @@ -35,7 +35,7 @@ programchoicesinit() { # Scripts menu echo $WMCLASS | grep -i "scripts" && CHOICES="$(echo " Web Search ^ 0 ^ sxmo_websearch.sh - Timer ^ 0 ^ sxmo_timermenu.sh + Timer ^ 0 ^ sxmo_timer.sh Youtube ^ 0 ^ sxmo_youtube.sh video Youtube (Audio) ^ 0 ^ sxmo_youtube.sh audio Weather ^ 0 ^ sxmo_weather.sh diff --git a/scripts/core/sxmo_brightness.sh b/scripts/core/sxmo_brightness.sh index a6692ec..2659425 100755 --- a/scripts/core/sxmo_brightness.sh +++ b/scripts/core/sxmo_brightness.sh @@ -15,7 +15,8 @@ setdelta() { xargs -INUM echo -e "$MIN\nNUM" | sort -n | tail -n1 | xargs -INUM echo -e "$MAX\nNUM" | sort -n | head -n1 ) - sxmo_notify.sh 200 "Backlight $(cat $DEV/brightness)/${MAX}" + + dunstify -i 0 -u normal -r 999 "☀ $(cat $DEV/brightness)/${MAX}" } up() { diff --git a/scripts/core/sxmo_notify.sh b/scripts/core/sxmo_notify.sh deleted file mode 100755 index 4af5203..0000000 --- a/scripts/core/sxmo_notify.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env sh -HEIGHT=30 -W=$1 -FULLW=$( - xdpyinfo | - grep 'dimensions' | - egrep -o "[0-9]+x[0-9]+ pixels" | - sed "s/x.*//" -) -OFFX=$(echo $FULLW - $W - 2 | bc) - -sh -c "echo $2 | dzen2 -p 2 -h $HEIGHT -x $OFFX -y 30" & diff --git a/scripts/core/sxmo_vol.sh b/scripts/core/sxmo_vol.sh index 5b37fef..546bf00 100755 --- a/scripts/core/sxmo_vol.sh +++ b/scripts/core/sxmo_vol.sh @@ -1,12 +1,13 @@ #!/usr/bin/env sh notify() { - sxmo_notify.sh 200 "Volume $( + VOL="$( amixer get "$(sxmo_audiocurrentdevice.sh)" | grep -oE '([0-9]+)%' | tr -d ' %' | awk '{ s += $1; c++ } END { print s/c }' | xargs printf %.0f )" + dunstify -i 0 -u normal -r 998 "♫ $VOL" echo 1 > /tmp/sxmo_bar } diff --git a/scripts/core/sxmo_xinit.sh b/scripts/core/sxmo_xinit.sh index 6b818b4..2806837 100755 --- a/scripts/core/sxmo_xinit.sh +++ b/scripts/core/sxmo_xinit.sh @@ -18,6 +18,5 @@ keynav & conky -c /usr/share/sxmo/conky.conf -d autocutsel & autocutsel -selection PRIMARY & -lisgd -t 500 & sxmo_statusbar.sh & -exec dbus-run-session dwm 2> ~/.dwm.log +exec dbus-run-session sh -c "dunst -conf /usr/share/sxmo/dunst.conf & lisgd -t 500 & dwm 2> ~/.dwm.log"