Change dunstify to notidy-send

This commit is contained in:
Thomas Dehaeze 2022-02-06 21:45:41 +01:00
parent 2c108d1682
commit b1de90b743
9 changed files with 69 additions and 73 deletions

View File

@ -48,13 +48,13 @@ drive=$(echo -e 'ESRF\nNAS' | rofi -dmenu -no-custom -p 'Drive:' -l 20);
if grep -qs "/home/thomas/mnt/$drive" /proc/mounts; then
umount "/home/thomas/mnt/$drive" && \
dunstify --replace=58249 "$drive " 'Successfully unmounted' || \
dunstify --replace=58249 --urgency=critical "$drive " 'Error while unmounted'
notify-send "$drive " 'Successfully unmounted' || \
notify-send --urgency=critical "$drive " 'Error while unmounted'
else
echo "It's not mounted."
mount "/home/thomas/mnt/$drive" && \
dunstify --replace=58249 "$drive " 'Successfully mounted' || \
dunstify --replace=58249 --urgency=critical "$drive " 'Error while mounted'
notify-send "$drive " 'Successfully mounted' || \
notify-send --urgency=critical "$drive " 'Error while mounted'
fi
#+end_src

View File

@ -135,7 +135,7 @@ if [ ! -z "$ps_line" ]; then
name=$(echo $ps_line | awk '{print $4}')
kill -15 $pid && \
dunstify "Kill" "$name (PID $pid)" &
notify-send "Kill" "$name (PID $pid)" &
fi
#+end_src
@ -152,14 +152,14 @@ tmpfile="/tmp/vpnstatus";
if [[ $(nordvpn status) == *"Connected"* ]]; then
nordvpn disconnect && \
dunstify --replace=23198 "VPN" "Disconnected" && \
notify-send "VPN" "Disconnected" && \
echo "off" > $tmpfile;
else
# Select Country to connect to
country=`cat ~/.local/data/nordvpn_countries.txt | rofi -i -dmenu | sed 's/\s/_/g'`;
dunstify --replace=23198 "VPN" "Connecting to $country...";
notify-send "VPN" "Connecting to $country...";
nordvpn connect $country && \
dunstify --replace=23198 "VPN" "Connected to $country" && \
notify-send "VPN" "Connected to $country" && \
echo "on" > $tmpfile;
fi
#+end_src
@ -715,7 +715,7 @@ if [ -n "$1" ]; then
xdotool key Shift+Insert
else
echo "$chosen" | tr -d '\n' | xsel -ib
dunstify "'$chosen' copied to clipboard." &
notify-send "'$chosen' copied to clipboard." &
fi
#+end_src
@ -739,7 +739,7 @@ if [ -n "$1" ]; then
xdotool key Shift+Insert
else
echo "$chosen" | tr -d '\n' | xsel -ib
dunstify "'$chosen' copied to clipboard." &
notify-send "'$chosen' copied to clipboard." &
fi
#+end_src
@ -850,8 +850,8 @@ if [ $TMUX ]; then
tmux split -v -l 1 "curl --progress-bar -F\"file=@$1\" https://0x0.st | xsel -ib;" && tmux select-pane -U
else
curl --progress-bar -F"file=@$1" https://0x0.st | xsel -ib && \
dunstify 'Upload' 'Successful' || \
dunstify --urgency=critical 'Upload' 'Failed'
notify-send 'Upload' 'Successful' || \
notify-send --urgency=critical 'Upload' 'Failed'
fi
#+end_src
@ -914,8 +914,8 @@ fi
if [ -n "$1" ]; then
doi2bib $doi | xsel -ib && \
dunstify 'BibTeX' 'Copied to Clipboard' || \
dunstify --urgency=critical 'BibTeX' 'Failed'
notify-send 'BibTeX' 'Copied to Clipboard' || \
notify-send --urgency=critical 'BibTeX' 'Failed'
fi
#+end_src

View File

@ -188,7 +188,7 @@ if [[ -f $1 ]]; then
exit;
fi
khal import -a "$calendar" --batch $1 && \
dunstify "Calendar" "Even added";
notify-send --hint=string:x-dunst-stack-tag:fJeNG8gc "Calendar" "Even added";
fi
fi
#+end_src

View File

@ -92,7 +92,7 @@ mpd_music_dir = ~/Music
Notification of song change.
#+begin_src conf
execute_on_song_change = dunstify --replace=19845 "Now Playing ♫" "$(mpc current)"
execute_on_song_change = notify-send --hint=string:x-dunst-stack-tag:Z7uCd3ZP "Now Playing ♫" "$(mpc current)"
#+end_src
Better user interface

View File

@ -68,7 +68,7 @@ notify-always no
:END:
#+begin_src bash
dunstify --replace=38492 "Newsboat " "$1"
notify-send "Newsboat " "$1"
#+end_src
** Bindings
@ -122,7 +122,7 @@ bookmark-interactive no
#+begin_src bash
buku --add "$1" --title "$2" --comment "$3" && \
dunstify "Buku" "Bookmark Added" && \
notify-send "Buku" "Bookmark Added" && \
exit 0
#+end_src

View File

@ -327,11 +327,11 @@ fi
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
dunstify --replace=98465 "Mails " "Syncing...";
notify-send --hint=string:x-dunst-stack-tag:YpqAgorv "Mails " "Syncing...";
checkmail -q && \
mail_nb=`du -a ~/.mail/*/Inbox/new/* 2>/dev/null | wc -l` && \
if [ "$mail_nb" -eq "0" ]; then
dunstify --replace=98465 "Mails " "No new mail";
notify-send --hint=string:x-dunst-stack-tag:YpqAgorv "Mails " "No new mail";
fi
#+end_src
@ -381,7 +381,7 @@ fi
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
dunstify --replace=38492 "Newsboat " "Reloading...";
notify-send --hint=string:x-dunst-stack-tag:4z5CvV6G "Newsboat " "Reloading...";
if pgrep -x "newsboat" >/dev/null; then
# If newsboat is already running, try to refresh in the tmux session
@ -389,7 +389,7 @@ if pgrep -x "newsboat" >/dev/null; then
else
newsboat -x reload && /
news_nb=`newsboat -x print-unread | cut -d " " -f1` && \
dunstify --replace=38492 "Newsboat " "$news_nb Unread News";
notify-send --hint=string:x-dunst-stack-tag:4z5CvV6G "Newsboat " "$news_nb Unread News";
fi
#+end_src
@ -493,10 +493,10 @@ fi
#+begin_src bash
if pgrep -x "redshift" >/dev/null; then
killall redshift && \
dunstify --replace=36492 "Redshift 望" "Turned off";
notify-send --hint=string:x-dunst-stack-tag:EKFLpst1 "Redshift 望" "Turned off";
else
nohup redshift > /dev/null 2>&1 &
dunstify --replace=36492 "Redshift 望" "Starting...";
notify-send --hint=string:x-dunst-stack-tag:EKFLpst1 "Redshift 望" "Starting...";
fi
#+end_src
@ -539,16 +539,16 @@ fi
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+BEGIN_SRC bash
dunstify --replace=64654 'Packages ' "Refreshing..."
notify-send --hint=string:x-dunst-stack-tag:SE5nDEVA 'Packages ' "Refreshing..."
paru -Sy > /dev/null 2>&1 && \
package_nb=$(paru -Qu 2> /dev/null | wc -l) || \
package_nb=0
if [ "$package_nb" -eq "0" ]; then
dunstify --replace=64654 'Packages ' "No upgrade available"
notify-send --hint=string:x-dunst-stack-tag:SE5nDEVA 'Packages ' "No upgrade available"
else
dunstify --replace=64654 'Packages ' "$package_nb upgrade(s) available"
notify-send --hint=string:x-dunst-stack-tag:SE5nDEVA 'Packages ' "$package_nb upgrade(s) available"
fi
#+END_SRC
@ -606,9 +606,9 @@ tmpfile="/tmp/dunststatus";
if [ -f $tmpfile ] && grep -q "off" $tmpfile ; then
killall -SIGUSR2 dunst && \
echo "on" > $tmpfile;
dunstify --replace=16549 "Notifications " "Activated";
notify-send --hint=string:x-dunst-stack-tag:KLJ63nVo "Notifications " "Activated";
else
dunstify --replace=16549 "Notifications " "Deactivated";
notify-send --hint=string:x-dunst-stack-tag:KLJ63nVo "Notifications " "Deactivated";
sleep 1 && \
killall -SIGUSR1 dunst && \
echo "off" > $tmpfile;
@ -654,10 +654,10 @@ fi
#+begin_src bash
if pgrep -x "xautolock" >/dev/null ; then
pkill xautolock && \
dunstify --replace=13602 'Lock Screen ' 'Desactivated'
notify-send --hint=string:x-dunst-stack-tag:tH6bxvvv 'Lock Screen ' 'Desactivated'
else
xautolock -locker "~/.local/bin/lockscreen" -detectsleep -time 30 -notify 60 -notifier "dunstify --replace=31846 -u critical -t 10000 -- 'Locking Screen' '60 seconds'" &
dunstify --replace=13602 'Lock Screen ' 'Activated'
xautolock -locker "~/.local/bin/lockscreen" -detectsleep -time 30 -notify 60 -notifier "notify-send -u --hint=string:x-dunst-stack-tag:tH6bxvvv critical -t 10000 -- 'Locking Screen' '60 seconds'" &
notify-send --hint=string:x-dunst-stack-tag:tH6bxvvv 'Lock Screen ' 'Activated'
fi
#+end_src
@ -718,13 +718,13 @@ isdevicedown=$(nmcli device status | grep ^$1 | grep disconnected)
if [ -z "$isdevicedown" ]
then
dunstify --replace=84847 "$1" "Disconnecting..." && \
notify-send --hint=string:x-dunst-stack-tag:EfjAHGgu "$1" "Disconnecting..." && \
nmcli device disconnect $1 && \
dunstify --replace=84847 "$1" "Disconnected"
notify-send --hint=string:x-dunst-stack-tag:EfjAHGgu "$1" "Disconnected"
else
dunstify --replace=84847 "$1" "Connection..." && \
notify-send --hint=string:x-dunst-stack-tag:EfjAHGgu "$1" "Connection..." && \
nmcli device connect $1 && \
dunstify --replace=84847 "$1" "Connected"
notify-send --hint=string:x-dunst-stack-tag:EfjAHGgu "$1" "Connected"
fi
#+end_src
@ -788,10 +788,10 @@ isconnected=$(bluetoothctl show $controllerid | grep Powered | grep yes)
if [ -z "$isconnected" ]
then
bluetoothctl power on && \
dunstify --replace=88498 "Bluetooth" "Power ON"
notify-send --hint=string:x-dunst-stack-tag:kidF4g53 "Bluetooth" "Power ON"
else
bluetoothctl power off && \
dunstify --replace=88498 "Bluetooth" "Power OFF"
notify-send --hint=string:x-dunst-stack-tag:kidF4g53 "Bluetooth" "Power OFF"
fi
#+end_src
@ -868,16 +868,12 @@ fi
:END:
#+begin_src bash
config="homelab"
connection=$(sudo wg show "$config" 2>/dev/null | head -n 1 | awk '{print $NF }')
if [ "$connection" = "$config" ]; then
sudo wg-quick down "$config" && \
dunstify --replace=83244 "Wireguard" "Disconnected from $config"
if pgrep -x "highlight-point" >/dev/null; then
killall highlight-point && \
notify-send --hint=string:x-dunst-stack-tag:kidF4g53 "Cursor" "Turned off";
else
sudo wg-quick up "$config" && \
dunstify --replace=83244 "Wireguard" "Connected to $config"
nohup highlight-pointer -r 10 > /dev/null 2>&1 &
notify-send --hint=string:x-dunst-stack-tag:kidF4g53 "Cursor" "Highlight...";
fi
#+end_src

View File

@ -397,12 +397,12 @@ username=$(echo -e "dehaeze.thomas@gmail.com\nthomas.dehaeze@esrf.fr\ntdehaeze"
password=$(rofi -p "Password" -dmenu -password -lines 1)
if [ -z "$url" ] || [ -z "$username" ] || [ -z "$password" ]; then
dunstify --urgency=critical "Pass" "Failed to Add Password"
notify-send --hint=string:x-dunst-stack-tag:0vRM5AMP --urgency=critical "Pass" "Failed to Add Password"
else
echo -e "$password\nlogin: $username\nurl: $QUTE_URL" > /tmp/add-password.txt
pass insert --multiline "$url/$username" < /tmp/add-password.txt;
rm /tmp/add-password.txt
dunstify "Pass " "Password Added"
notify-send --hint=string:x-dunst-stack-tag:0vRM5AMP "Pass " "Password Added"
fi
#+end_src
@ -415,15 +415,15 @@ if [[ "$1" == *"list"* ]]; then
fi
if [ -n "$choice" ] && [ "$choice" = "Playlist" ]; then
dunstify --replace=19243 "Youtube " "Downloading Playlist...";
notify-send --hint=string:x-dunst-stack-tag:iOGRwrDG "Youtube " "Downloading Playlist...";
youtube-dl -i -f 'bestvideo[height<=720]+bestaudio/best[height<=720]' "$1" -o "%(playlist_title)s/%(playlist_index)s-%(title)s.%(ext)s" && \
dunstify --replace=19243 "Youtube " "Downloaded" || \
dunstify --replace=19243 --urgency=critical "Youtube " "Failed to download"
notify-send --hint=string:x-dunst-stack-tag:iOGRwrDG "Youtube " "Downloaded" || \
notify-send --hint=string:x-dunst-stack-tag:iOGRwrDG --urgency=critical "Youtube " "Failed to download"
else
dunstify --replace=19243 "Youtube " "Downloading Video...";
notify-send --hint=string:x-dunst-stack-tag:iOGRwrDG "Youtube " "Downloading Video...";
youtube-dl --no-playlist -f 'bestvideo[height<=720]+bestaudio/best[height<=720]' "$1" && \
dunstify --replace=19243 "Youtube " "Downloaded" || \
dunstify --replace=19243 --urgency=critical "Youtube " "Failed to download"
notify-send --hint=string:x-dunst-stack-tag:iOGRwrDG "Youtube " "Downloaded" || \
notify-send --hint=string:x-dunst-stack-tag:iOGRwrDG --urgency=critical "Youtube " "Failed to download"
fi
#+end_src
@ -627,8 +627,8 @@ new_tags=$(rofi -p "New tags" -dmenu)
formated_tags=$(echo $existing_tags $new_tags | sed -E 's/(\w+)/"\1"/g;s/\s/,/g')
curl -H "Authorization: Token ${LINKDING_TOKEN}" -H "Content-Type: application/json" -d "{\"url\": \"$QUTE_URL\", \"title\": \"$title\", \"tag_names\": [$formated_tags]}" ${LINKDING_URL}/api/bookmarks/ && \
dunstify "Linkding" " Bookmark Added" || \
dunstify --urgency=critical "Linkding" "Failed"
notify-send --hint=string:x-dunst-stack-tag:l3gV75RD "Linkding" " Bookmark Added" || \
notify-send --hint=string:x-dunst-stack-tag:l3gV75RD --urgency=critical "Linkding" "Failed"
#+end_src
** Add Url to Buku using Rofi
@ -637,28 +637,28 @@ title=$(echo "$QUTE_TITLE" | rofi -p "Title" -dmenu -lines 1)
tags=$(buku -t --nc --np | sed -e 's/\s*[[:digit:]]*\.\s*\(.*\)\s*([[:digit:]]*)\s*/\1/' -e '/^\s*$/d' | sort | uniq | rofi -multi-select -p "Tags" -dmenu | tr "\n" "," | sed 's/\s*,\s*$//')
buku --add "$QUTE_URL" --tag "$tags" --title "$title" && \
dunstify "Buku" "Bookmark Added" || \
dunstify --urgency=critical "Buku" " Bookmark Added"
notify-send --hint=string:x-dunst-stack-tag:E3TueNZ0 "Buku" "Bookmark Added" || \
notify-send --hint=string:x-dunst-stack-tag:E3TueNZ0 --urgency=critical "Buku" " Bookmark Added"
#+end_src
** Add Url to Buku without asking for information
#+begin_src bash :tangle ~/.config/qutebrowser/userscripts/buku-add.sh
buku --add $QUTE_URL --title "$QUTE_TITLE" && \
dunstify "Buku" "📑 Bookmark Added"
notify-send "Buku" "📑 Bookmark Added"
#+end_src
** Download with aria2c
#+begin_src bash :tangle ~/.config/qutebrowser/userscripts/aria2c-add.sh
aria2p add "$1" && \
dunstify "Aria2" "Download Started" || \
dunstify "Aria2" "Error"
notify-send --hint=string:x-dunst-stack-tag:2SGClDoI "Aria2" "Download Started" || \
notify-send --hint=string:x-dunst-stack-tag:2SGClDoI "Aria2" "Error"
#+end_src
** Download with aria2c on the Homelab
#+begin_src bash :tangle ~/.config/qutebrowser/userscripts/aria2c-add-homelab.sh
dl-add $(echo "$1" | sed 's/\&af=.*$//g') && \
dunstify "Aria2" "Download Started" || \
dunstify "Aria2" "Error"
notify-send --hint=string:x-dunst-stack-tag:2SGClDoI "Aria2" "Download Started" || \
notify-send --hint=string:x-dunst-stack-tag:2SGClDoI "Aria2" "Error"
#+end_src
** Save to PNG
@ -679,7 +679,7 @@ filename=$(rofi -p "filename" -dmenu -lines 1)
if [ -n "$filename" ]; then
cd ~/Pictures/ && \
percollate pdf --css "@page { size: A4 portrait }" --output "$filename.pdf" "$QUTE_URL" && \
dunstify "Percollate" "Successfully saved to pdf"
notify-send "Percollate" "Successfully saved to pdf"
fi
#+end_src
@ -689,7 +689,7 @@ passname=$(ls ~/.password-store/totp-* | xargs -n 1 basename | sed -e 's/\..*$//
if [ -n "$passname" ]; then
pass otp $passname | xsel -ib && \
dunstify 'OTP' 'copied to clipboard.' &
notify-send 'OTP' 'copied to clipboard.' &
fi
#+end_src
@ -698,12 +698,12 @@ fi
m3u8_path=`curl -L -s "$QUTE_URL" | pcregrep -o1 "file = \"\/(.*aes.*mp4)\""`
if [ -z "$m3u8_path" ]; then
dunstify --urgency=critical "Qutebrowser" "No m3u8 playlist found"
notify-send --hint=string:x-dunst-stack-tag:ng4iXDxP --urgency=critical "Qutebrowser" "No m3u8 playlist found"
else
dunstify "Qutebrowser" "Downloads..." && \
notify-send --hint=string:x-dunst-stack-tag:ng4iXDxP "Qutebrowser" "Downloads..." && \
cd ~/Downloads/ && \
ffmpeg -user_agent "Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0" -referer "$QUTE_URL" -i "https://cdn2.digitellinc.com/play/_definst_/mp4:$m3u8_path/playlist.m3u8" -c copy "$QUTE_TITLE.mp4" && \
dunstify "Qutebrowser" "$QUTE_TITLE Downloaded"
notify-send --hint=string:x-dunst-stack-tag:ng4iXDxP "Qutebrowser" "$QUTE_TITLE Downloaded"
fi
#+end_src

View File

@ -155,7 +155,7 @@ old="$(($gmail_old+$esrf_old+$ulg_old+$uliege_old))"
# =============================================================
# Notification
if [ "$new" -gt 0 ]; then
dunstify --replace=98465 'Mails ' "$(($gmail_new+$esrf_new+$ulg_new+$uliege_new)) new mail(s)"
notify-send --hint=string:x-dunst-stack-tag:fV84ivMi 'Mails ' "$new new mail(s)"
fi
# =============================================================

View File

@ -65,15 +65,15 @@ on-download-error=/home/thomas/.config/aria2/download-error.sh
** Download Start Script
#+begin_src bash :tangle ~/.config/aria2/download-start.sh :comments both :mkdirp yes :shebang "#!/bin/bash"
dunstify "DL Started" "$(basename \"$3\" 2> /dev/null)"
notify-send --hint=string:x-dunst-stack-tag:bHEPn7rW "DL Started" "$(basename \"$3\" 2> /dev/null)"
#+end_src
** Download Complete Script
#+begin_src bash :tangle ~/.config/aria2/download-complete.sh :comments both :mkdirp yes :shebang "#!/usr/bin/env bash"
dunstify "DL Completed" "$(basename \"$3\" 2> /dev/null)"
notify-send --hint=string:x-dunst-stack-tag:bHEPn7rW "DL Completed" "$(basename \"$3\" 2> /dev/null)"
#+end_src
** Download Error Script
#+begin_src bash :tangle ~/.config/aria2/download-error.sh :comments both :mkdirp yes :shebang "#!/usr/bin/env bash"
dunstify --urgency=critical "DL Failed" "$(basename \"$3\" 2> /dev/null)"
notify-send --hint=string:x-dunst-stack-tag:bHEPn7rW --urgency=critical "DL Failed" "$(basename \"$3\" 2> /dev/null)"
#+end_src