X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=filesystem%2Fusr%2Flocal%2Fbin%2Fabrowser;fp=filesystem%2Fusr%2Flocal%2Fbin%2Fabrowser;h=d3ce6431f1053ecc4d4ffcb7527bba948c78ac6c;hb=e801d1a57f0b30c57c6f644ab06a0f790159b236;hp=7892cc7cafcc2838882dd39a62bae1f0084a842a;hpb=38387a0fbfcc731fbd5785d4c035c5121a4c9281;p=distro-setup diff --git a/filesystem/usr/local/bin/abrowser b/filesystem/usr/local/bin/abrowser index 7892cc7..d3ce643 100755 --- a/filesystem/usr/local/bin/abrowser +++ b/filesystem/usr/local/bin/abrowser @@ -43,11 +43,13 @@ i3-msg -t get_tree | jq -e '.nodes[].nodes[].nodes[].nodes | [.[]] + ( [.[].node # prefer abrowser if type -P abrowser &>/dev/null; then - abrowser "$@" & + b=abrowser else - firefox "$@" & + b=firefox fi +$b "$@" & + # on a fast computer, .5 is too fast, 1 is ok. on x200, 1 is too fast, 2 is ok. sleep 2 # debug @@ -60,7 +62,7 @@ if (( $# == 0 )) && ! i3-msg -t get_tree | jq --stream -r 'select(.[1]|scalars!= # into a single array instead of a list of arrays with [.[]], or else # it will add the arrays a bunch of times and give several results. # comm gives us just the new id. - id=$(i3-msg -t get_tree | jq -e '.nodes[].nodes[].nodes[].nodes | [.[]] + ( [.[].nodes[]]) + ( [.[].nodes[].nodes[]]) + ( [.[].nodes[].nodes[].nodes[]]) | .[] | select(.window_properties.class=="abrowser") | .id' | comm -23 - $tmpf | head -n1) + id=$(i3-msg -t get_tree | jq -e '.nodes[].nodes[].nodes[].nodes | [.[]] + ( [.[].nodes[]]) + ( [.[].nodes[].nodes[]]) + ( [.[].nodes[].nodes[].nodes[]]) | .[] | select(.window_properties.class=="'$b'") | .id' | comm -23 - $tmpf | head -n1) rm -f $tmpf if [[ $id ]]; then i3-msg "[con_id=$id] mark abrowser"