1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2025-07-01 10:29:26 +00:00

Make shell scripts (almost) POSIX compliant

This commit is contained in:
2019-11-17 17:29:34 +01:00
parent 9d6bbeae7c
commit 5211d4aacb
6 changed files with 38 additions and 55 deletions

View File

@ -2,16 +2,16 @@
set -e
[[ -z $1 ]] && exit 1
[ -z "$1" ] && exit 1
active_window=$(xdotool getactivewindow)
window=$(xdotool search --name "$1")
[[ $? -ne 0 ]] && exit 1
[ "$?" -ne 0 ] && exit 1
if [[ $active_window == $window ]]; then
xdotool windowminimize $window
if [ "$active_window" = "$window" ]; then
xdotool windowminimize "$window"
else
xdotool windowactivate $window
xdotool windowactivate "$window"
fi
exit 0