From d0ecb2a9d770b1987e3be7cdc549d46880b89c5e Mon Sep 17 00:00:00 2001 From: Tom van der Lee Date: Sun, 22 Feb 2015 17:15:39 +0100 Subject: Moved from stow to dotfiles for dotfile management --- config/herbstluftwm/popup.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 config/herbstluftwm/popup.sh (limited to 'config/herbstluftwm/popup.sh') 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 @@ +#!/bin/bash + +help () { + echo -e "Usage: popup.sh [OPTIONS]" + echo -e "Spawns a popup for a certain amount of time" + echo -e "" + echo -e "Options:" + echo -e " -m MESSAGE\t\tSpecifies message to be displayed" + echo -e " -t TIMEOUT\t\tAmount of time in seconds the popup is displayed" + echo -e " -u LEVEL\t\tUrgency level (info or high)" +} + +dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +source "$dir/theme.sh" + +timeout=10 +message="" +urgency="info" + +while getopts ":m:t:x:y:w:h:u:" opt; do + case $opt in + m) message=$OPTARG ;; + t) timeout=$OPTARG ;; + u) urgency=$OPTARG ;; + esac +done + +if test ! $message; then + help +else + + bar_opts="-f $font,$font_sec -B $acolor_bg -F $acolor_fg -g ${popup_width}x${height}+${popup_x}+${popup_y} -u 2" + + t=$(date +%T) + + if [ $urgency == "info" ]; then + prefix="Info:" + elif [ $urgency == "high" ]; then + prefix="!!WARNING:" + fi + + { + echo "%{F$acolor_accent} $prefix %{F$acolor_fg}$message %{F$acolor_fg}($t)%{F-}" + sleep $timeout + } | bar $bar_opts +fi -- cgit v1.2.3