Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 48 lines (41 sloc) 1.319 kb
#!/bin/sh
exec &>/dev/null
windowname="$(xdotool search --onlyvisible . | while read -r; do
[ "$WINDOWID" == "$REPLY" ] && continue
xwininfo -id $REPLY | sed -n '/^xwininfo/s:.*"\(.\+\)".*:\1:p'
done | sort | uniq | dmenu -p "Select window by name: " -i -fn \
"-*-terminus-medium-r-*-*-12-*-*-*-*-*-*-*")"
windowid="$(xdotool search --onlyvisible "$windowname" | grep -v "$WINDOWID")"
idcount="$(wc -l <<EOF
$windowid
EOF
)"
if [ "$idcount" -eq 0 ]; then
xdotool search --onlyvisible "$windowname" windowactivate
else
[ "$idcount" -gt 1 ] && windowid="$(dmenu -p "Select window id: " \
-i -fn "-*-terminus-medium-r-*-*-12-*-*-*-*-*-*-*" <<EOF
$windowid
EOF
)"
xdotool windowactivate "$windowid"
fi
# #!/bin/bash
#
# # titles as ids is problematic
# # anything unescaped will break this (':? etc)
#
# declare -A wins
#
# while read -r id; do
# name="$(xprop -id $id | sed -n 's/WM_NAME(STRING) = "\(.*\)"/\1/p')"
# [[ -z "${wins["$name"]}" ]] && wins+=(["$name"]="$id") || wins["$name"]+=" $id"
# done < <(xdotool search --onlyvisible .)
#
# sel="$(printf "%s\n" "${!wins[@]}" | dmenu -i)"
#
# ids=(${wins["$sel"]})
# (( ${#ids[@]} > 1 )) && id="$(printf -- "%s\n" "${ids[@]}" | dmenu -i)" || id="${ids["${sel}"]}"
#
# xdotool windowactivate "$id"
#
Jump to Line
Something went wrong with that request. Please try again.