@ -502,26 +502,26 @@ create_win_return_wid() {
# blacklist all existing wids of program
# blacklist all existing wids of program
# (for programs where one pid shares all wids)
# (for programs where one pid shares all wids)
blacklist=$(xdotool search --classname "$program")
blacklist=$(xdotool search --classname "$program")
# need to redirect stdout or function won't return
# for programs where $! won't always work (e.g. one pid for all windows)
program_command="$1 > /dev/null &"
if [[ $program =~ ^(terminix|xfce4-terminal)$ ]]; then
# for programs where $! won't give the correct pid
pid=$(pgrep -x "$program")
if [[ $program =~ ^(terminix|xfce4-terminal)$ ]] \
&& pid=$(pgrep -x "$program"); then
eval "$program_command"
elif [[ $program == urxvtc ]]; then
elif [[ $program == urxvtc ]]; then
blacklist=$(xdotool search --classname urxvtd)
blacklist=$(xdotool search --classname urxvtd)
pid=$(pgrep urxvtd)
pid=$(pgrep -x urxvtd)
eval "$program_command"
elif [[ $program == chromium ]]; then
elif [[ $program =~ ^chromium ]] && pgrep -x chromium; then
# this may work fine
# this may work fine
# pid=$(pgrep -o chromium)
# pid=$(pgrep -x o chromium)
pid=$(pgrep -xa chromium | awk '!/--type/ {print $1}')
pid=$(pgrep -xa chromium | awk '!/--type/ {print $1}')
eval "$program_command"
elif [[ $program == chromium-browser ]]; then
elif [[ $program =~ ^google-chrome ]] && pgrep -x chrome; then
pid=$(pgrep -xa chromium-browse | awk '!/--type/ {print $1}')
elif [[ $program =~ ^google-chrome ]]; then
pid=$(pgrep -xa chrome | awk '!/--type/ {print $1}')
pid=$(pgrep -xa chrome | awk '!/--type/ {print $1}')
eval "$program_command"
fi
else
# need to redirect stdout or function won't return
eval "$program_command"
eval "$1 > /dev/null &"
if [[ -z $pid ]]; then
# for normal programs
# also for when one of the programs above hadn't already been started
pid=$!
pid=$!
fi
fi
visible_wid=false
visible_wid=false