-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalert
executable file
·52 lines (41 loc) · 1.54 KB
/
alert
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env bash
#
# ############################################################################
# Project: scripts (none)
# File...: alert
# Created: Wednesday, 2020/10/01 - 12:13:32
# Author.: @fbnmtz, ([email protected])
# ~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~~·~·~·~·~·~·~·~
# Last Modified: Monday, 2024/12/09 - 17:37:10
# Modified By..: @fbnmtz, ([email protected])
# ~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~~·~·~·~·~·~·~·~
# Version: 0.1.3.84
# ~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~~·~·~·~·~·~·~·~
# Description:
# >
source "$xSHELL_INIT"
use args
requirements notify-send mdate
APP_HOME=~/.fbnmtz/alert
[ ! -d $APP_HOME ] && mkdir -p $APP_HOME
# filename used for log
filename="$(mdate -y -m -d).log"
# define current app used for notifications
cmd='notify-send'
# define args
xarg --id -c,--critical --var level:critical --desc "define notification level as 'critical'"
xarg --id -t,--title --var title+r --desc "set title of notification"
xarg --id -m,--msg --var msg+r --desc "set mensage of notification"
# run params
xrun --xrequire-one --xversionrc "$@"
# define params to notification app
params="${@/-c/}"
params="${params/--critical/}"
# log notification
echo "$(mdate --us) | '$1' '$2' '$3'" >> $APP_HOME/$filename
# add critical level
if [ -n "$level" ]; then
params+=" -u $level"
fi
# send notification
$cmd $params