aboutsummaryrefslogtreecommitdiffstats
path: root/config/herbstluftwm/popup.sh
diff options
context:
space:
mode:
Diffstat (limited to 'config/herbstluftwm/popup.sh')
-rwxr-xr-xconfig/herbstluftwm/popup.sh46
1 files changed, 46 insertions, 0 deletions
diff --git a/config/herbstluftwm/popup.sh b/config/herbstluftwm/popup.sh
new file mode 100755
index 0000000..eda37f5
--- /dev/null
+++ b/config/herbstluftwm/popup.sh
@@ -0,0 +1,46 @@
1#!/bin/bash
2
3help () {
4 echo -e "Usage: popup.sh [OPTIONS]"
5 echo -e "Spawns a popup for a certain amount of time"
6 echo -e ""
7 echo -e "Options:"
8 echo -e " -m MESSAGE\t\tSpecifies message to be displayed"
9 echo -e " -t TIMEOUT\t\tAmount of time in seconds the popup is displayed"
10 echo -e " -u LEVEL\t\tUrgency level (info or high)"
11}
12
13dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
14source "$dir/theme.sh"
15
16timeout=10
17message=""
18urgency="info"
19
20while getopts ":m:t:x:y:w:h:u:" opt; do
21 case $opt in
22 m) message=$OPTARG ;;
23 t) timeout=$OPTARG ;;
24 u) urgency=$OPTARG ;;
25 esac
26done
27
28if test ! $message; then
29 help
30else
31
32 bar_opts="-f $font,$font_sec -B $acolor_bg -F $acolor_fg -g ${popup_width}x${height}+${popup_x}+${popup_y} -u 2"
33
34 t=$(date +%T)
35
36 if [ $urgency == "info" ]; then
37 prefix="Info:"
38 elif [ $urgency == "high" ]; then
39 prefix="!!WARNING:"
40 fi
41
42 {
43 echo "%{F$acolor_accent} $prefix %{F$acolor_fg}$message %{F$acolor_fg}($t)%{F-}"
44 sleep $timeout
45 } | bar $bar_opts
46fi