fi
# start emacs daemon for profanity if it doesnt exist.
-id=$(i3-msg -t get_tree | jq -e '.. | select(.name?) | select(.name | test("^e-irc ")).id')
+id=$(i3-msg -t get_tree | jq -e '.. | select(.name?) | select(.name | test("^iznc ")).id')
if [[ ! $id ]]; then
emacsclient -s profanity -nc &>/dev/null
# See the License for the specific language governing permissions and
# limitations under the License.
-
-id=$(i3-msg -t get_tree | jq -e '.. | select(.name?) | select(.name | test("^e-iak ")).id')
+# If there are more than one, just get the 1st one. There is probably
+# some better behavior to do in that case, but atm I don't want to think
+# about it.
+id=$(i3-msg -t get_tree | jq -e '.. | select(.name?) | select(.name | test("^e-iak ")).id'| sort -n| head -n1)
if [[ $id ]]; then
i3-msg "[con_id=\"$id\"] focus"
else
-
i3-msg "workspace 2"
i3-split-maybe
emacsclient -c
# that aren't errors can cause hang too, like when I added gnus
# git to load path.
-# I was experimenting with running
+# note: I was experimenting with running
# under gdb always to diagnose any hangs/crashes
# and it won't work due to a gdb crash:
# gdb -ex="set follow-fork-mode child" -ex=r -ex=quit --args emacsclient -nc
+#
# -n = --no-wait, go into background
# -c = create new frame instead of reusing the current frame
# -a = alternate editor, empty string makes it start emacs daemon.
if (( $# == 0 )); then
args+=" -c"
fi
- # duplicate -c, but oh well
- if ! pgrep -u $EUID emacsclient &>/dev/null; then
+
+ id=$(i3-msg -t get_tree | jq -e '.. | select(.name?) | select(.name | test("^e-iak ")).id'| sort -n| head -n1)
+
+ if [[ ! $id ]]; then
if (( $# == 0 )) && type -p gdb &>/dev/null; then
# no time for messing with gdb right now
#gdb=true
:
else
+ # duplicate arg, but oh well.
args+=" -c"
fi
fi