Image: Only call grep once

This commit is contained in:
Dylan Araps 2016-12-06 11:46:34 +11:00
parent 9c9e08f17d
commit 0fd55c5b5c
1 changed files with 2 additions and 1 deletions

View File

@ -2147,7 +2147,8 @@ get_term_size() {
elif type -p xwininfo >/dev/null 2>&1; then elif type -p xwininfo >/dev/null 2>&1; then
# Get the focused window's ID. # Get the focused window's ID.
if type -p xdpyinfo >/dev/null 2>&1; then if type -p xdpyinfo >/dev/null 2>&1; then
current_window="$(xdpyinfo | grep -F "focus" | grep -E -o "0x[0-9a-f]+")" current_window="$(xdpyinfo | grep -E -o "focus:.*0x[0-9a-f]+")"
current_window="${current_window/*window }"
elif type -p xprop >/dev/null 2>&1; then elif type -p xprop >/dev/null 2>&1; then
current_window="$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')" current_window="$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')"
fi fi