aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2023-06-19 10:09:47 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2023-06-19 10:09:47 +0200
commitc5d101ab2c9db3b1a001cb56953cb90b24f8fdcf (patch)
tree1286eccbd051723e443c26b43e739007ee53dc06
parent2c065927ff405b2d8b2eec6fc1fbee9c4f93e0a8 (diff)
downloadscripts-c5d101ab2c9db3b1a001cb56953cb90b24f8fdcf.tar.gz
scripts-c5d101ab2c9db3b1a001cb56953cb90b24f8fdcf.zip
Added notify
-rw-r--r--Makefile1
-rwxr-xr-xbattery-checknow2
-rwxr-xr-xconfig-backup2
-rwxr-xr-xdmenu-unmount3
-rwxr-xr-xnotify36
-rwxr-xr-xstatus10
-rwxr-xr-xxwallpaper-random-notify2
7 files changed, 48 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 939db4a..daf7c2a 100644
--- a/Makefile
+++ b/Makefile
@@ -18,6 +18,7 @@ SCRIPTS = addressgrep \
18 ffmpeg-facecam \ 18 ffmpeg-facecam \
19 mail-compose \ 19 mail-compose \
20 mergepdf \ 20 mergepdf \
21 notify \
21 open-file \ 22 open-file \
22 open-stdin \ 23 open-stdin \
23 open-url \ 24 open-url \
diff --git a/battery-checknow b/battery-checknow
index eb6335e..bde1ae2 100755
--- a/battery-checknow
+++ b/battery-checknow
@@ -4,7 +4,7 @@
4# Requires: battery-status, notify-battery 4# Requires: battery-status, notify-battery
5 5
6file="${XDG_DATA_HOME:-$HOME/.local/share}/batterystatus" 6file="${XDG_DATA_HOME:-$HOME/.local/share}/batterystatus"
7notify=herbe 7notify="notify push"
8low=20 8low=20
9crit=15 9crit=15
10 10
diff --git a/config-backup b/config-backup
index ef25940..8d38791 100755
--- a/config-backup
+++ b/config-backup
@@ -6,7 +6,7 @@ folder=$HOME/box/configbackups
6 6
7dotfiles=".bash_profile .bashrc .profile .inputrc .mblaze .nexrc .tmux.conf .xinitrc" 7dotfiles=".bash_profile .bashrc .profile .inputrc .mblaze .nexrc .tmux.conf .xinitrc"
8config="colors fontconfig git imv msmtp zathura" 8config="colors fontconfig git imv msmtp zathura"
9src="dmenu dwm herbe st" 9src="dmenu dwm st st-lightbg"
10share="gmni" 10share="gmni"
11 11
12mkdir -p $folder/config $folder/home $folder/share $folder/src 12mkdir -p $folder/config $folder/home $folder/share $folder/src
diff --git a/dmenu-unmount b/dmenu-unmount
index 57f0c41..2771ecc 100755
--- a/dmenu-unmount
+++ b/dmenu-unmount
@@ -6,7 +6,8 @@
6# Requires: udevil, dmenu (or similar), notify-send or similar (optional) 6# Requires: udevil, dmenu (or similar), notify-send or similar (optional)
7 7
8menu=dmenu 8menu=dmenu
9writeout=herbe 9#writeout=notify-send
10writeout="notify push"
10 11
11while getopts "m:w:" opt; do 12while getopts "m:w:" opt; do
12 case "$opt" in 13 case "$opt" in
diff --git a/notify b/notify
new file mode 100755
index 0000000..f3d996e
--- /dev/null
+++ b/notify
@@ -0,0 +1,36 @@
1#!/bin/sh
2
3# Simple notification manager.
4# Notifications are sent to a log file together with a time stamp.
5# Requires: xroot-update (optional)
6
7# Usage: notify [push MESSAGE | clean | edit | show]
8
9update=xroot-update
10file="${XDG_DATA_HOME:-.local/share}/notify"
11date=$(date +'%H:%M')
12
13usage() {
14 echo "Usage: notify [push MESSAGE | clean | edit | show]"
15}
16
17touch "$file"
18case "$1" in
19 push)
20 echo "(Notified $date) $2" >> "$file"
21 $update
22 ;;
23 clean)
24 printf "" > "$file"
25 $update
26 ;;
27 edit)
28 $EDITOR "$file"
29 ;;
30 show)
31 cat "$file"
32 ;;
33 *)
34 usage
35 ;;
36esac
diff --git a/status b/status
index 10b43f9..abd9bad 100755
--- a/status
+++ b/status
@@ -26,14 +26,16 @@ else
26 battery="No battery" 26 battery="No battery"
27fi 27fi
28 28
29#network=$(nmcli device status | head -n 2 | tail -n 1 | awk '{print "Network: " $4}')
30# NetworkManager has a dreadful command line interface 29# NetworkManager has a dreadful command line interface
31# It makes cry every time 30# It makes cry every time
32# pls help 31# pls help
33network="Network: $(nmcli device status | head -n 2 | tail -n 1 | sed 's/ *$//' | sed 's/.* //')" 32nwline="$(nmcli device status | head -n 2 | tail -n 1)"
33nwclean="$(echo "$nwline" | sed 's/ *$//' | sed 's/.* //')"
34network="Network: $nwclean"
34 35
35events=$(sdep-list past | wc -l) 36noticount=$(notify show | wc -l)
36 37
37printf "$network$sep$volume$sep$battery$sep$date$sep$time" 38printf "$network$sep$volume$sep$battery$sep$date$sep$time"
38[ "$events" != "0" ] && printf "$sep$events TODO task(s)" 39[ "$noticount" = "1" ] && printf "$sep$(notify show)"
40[ "$noticount" -gt "1" ] && printf "${sep}Unread notifications: $noticount"
39printf "\n" 41printf "\n"
diff --git a/xwallpaper-random-notify b/xwallpaper-random-notify
index b59a59f..6ab3d56 100755
--- a/xwallpaper-random-notify
+++ b/xwallpaper-random-notify
@@ -4,7 +4,7 @@
4# Requires: xwallpaper (or feh), notify-send or similar (optional) 4# Requires: xwallpaper (or feh), notify-send or similar (optional)
5 5
6#notify=notify-send 6#notify=notify-send
7notify=herbe 7notify="notify push"
8 8
9folder=~/pictures/wallpapers 9folder=~/pictures/wallpapers
10pic=$(ls $folder | sort -R | head -1) 10pic=$(ls $folder | sort -R | head -1)

Generated with cgit - Back to sebastiano.tronto.net