X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=i3-abrowser;h=2afbff3d2cdaafc82d147fe8f5632c8ee6e505fa;hb=ca61084446e48fb0703ce2a203c1bd18ceaf4dfb;hp=8c5a208f8e7e61cb50c09cb162d24c4512f55160;hpb=989554cab0d0c59d1aab20496ba9550acd17e6e6;p=distro-setup diff --git a/i3-abrowser b/i3-abrowser index 8c5a208..2afbff3 100755 --- a/i3-abrowser +++ b/i3-abrowser @@ -41,23 +41,29 @@ else b=firefox fi -# mark if we dont have a mark already -if i3-msg -t get_tree | jq --stream -r 'select(.[1]|scalars!=null) | "\(.[0]|join(".")): \(.[1]|tojson)"' | grep 'marks.0: "abrowser"$' &>/dev/null; then - h=$(i3-msg -t get_tree | jq -r ".. | select(.focused? == true) | .rect.height") - cur_workspace=$(i3-msg -t get_workspaces | jq -r '.[] | select(.focused? == true) | .name') - - # h tests if we have a current focus, but that is just a random guess. - if [[ $cur_workspace == 2 && $h ]]; then - i3-msg "swap container with mark abrowser; [con_mark=\"abrowser\"] focus" - else - i3-msg "[con_mark=\"abrowser\"] focus" - fi +# spawn and mark if we dont have a mark already +if ! /a/c/i3-focus-maybe abrowser; then -else i3-split-maybe $b "$@" & # on a fast computer, .5 is too fast, 1 is ok. on x200, 1 is too fast, 2 is ok. sleep 2 i3-msg "[workspace=__focused__ class=\"$b\" instance=\"Navigator\" window_role=\"browser\"] mark abrowser" wait + +# else + # # If we were streaming 1/4 of the screen without separate workspaces, we might + # # want something like this. But as is, it is better to just focus. same deal in + # # my other programs like this one, but I removed the code there. + # + # cur_workspace=$(i3-msg -t get_workspaces | jq -r '.[] | select(.focused? == true) | .name') + # i3-msg "[con_mark=\"abrowser\"] focus" + + # if [[ $cur_workspace == 2 ]]; then + # i3-msg "swap container with mark abrowser; [con_mark=\"abrowser\"] focus" + # else + # i3-msg "[con_mark=\"abrowser\"] focus" + # fi + + fi