Skip to content

Instantly share code, notes, and snippets.

@ratmice
Last active June 14, 2022 04:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ratmice/72705ded485c59931c221fb6b05944ad to your computer and use it in GitHub Desktop.
Save ratmice/72705ded485c59931c221fb6b05944ad to your computer and use it in GitHub Desktop.
launch another wezterm in the current directory (sway)...
#!/bin/sh
alias wezterm=~/.cargo/bin/wezterm
if [ $(swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true and .window_properties.class == "org.wezfurlong.wezterm").window_properties.class, select(.focused==true and .app_id =="org.wezfurlong.wezterm").app_id') ];
then
PANE_ID=$(wezterm cli list-clients --format json | jq '.[] | .focused_pane_id')
WORKDIR=$(wezterm cli list --format json | jq -r ".[] | select(.pane_id == $PANE_ID).cwd")
wezterm cli spawn --new-window --cwd ${WORKDIR#file://}
false
else
wezterm
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment