diff options
| author | 2015-02-22 17:15:39 +0100 | |
|---|---|---|
| committer | 2015-02-22 17:15:39 +0100 | |
| commit | d0ecb2a9d770b1987e3be7cdc549d46880b89c5e (patch) | |
| tree | d493b4afd8268adb3e1f374cd73e5db662f260d6 /config/herbstluftwm/popup.sh | |
| parent | b86e22c339276441f344d61ad104a7cebd3b5858 (diff) | |
| download | dotfiles-d0ecb2a9d770b1987e3be7cdc549d46880b89c5e.tar.gz dotfiles-d0ecb2a9d770b1987e3be7cdc549d46880b89c5e.tar.bz2 dotfiles-d0ecb2a9d770b1987e3be7cdc549d46880b89c5e.zip | |
Moved from stow to dotfiles for dotfile management
Diffstat (limited to 'config/herbstluftwm/popup.sh')
| -rwxr-xr-x | config/herbstluftwm/popup.sh | 46 |
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 | |||
| 3 | help () { | ||
| 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 | |||
| 13 | dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
| 14 | source "$dir/theme.sh" | ||
| 15 | |||
| 16 | timeout=10 | ||
| 17 | message="" | ||
| 18 | urgency="info" | ||
| 19 | |||
| 20 | while 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 | ||
| 26 | done | ||
| 27 | |||
| 28 | if test ! $message; then | ||
| 29 | help | ||
| 30 | else | ||
| 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 | ||
| 46 | fi | ||
