mirror of
https://gitlab.com/sagidayan/linux-config.git
synced 2024-11-22 23:35:26 +00:00
Sagi Dayan
79ab87fa07
- tmux key-bindings for save/open/delete workspace - each workspace has a layout based on common.sh functions such as `ide` `grid` and `layout`
37 lines
665 B
Bash
Executable file
37 lines
665 B
Bash
Executable file
#!/bin/bash
|
|
|
|
JSON_PATH=~/.shellconfig/workspaces/workspaces.json
|
|
|
|
WSP=$(cat ${JSON_PATH} \
|
|
| jq -r 'keys[]' \
|
|
| fzf --reverse --header "Select a Project to open"
|
|
)
|
|
|
|
if [ -z $WSP ]; then
|
|
echo "Aborted"
|
|
exit 1
|
|
fi
|
|
|
|
DIR=$(cat ${JSON_PATH} \
|
|
| jq -r --arg WSP "${WSP}" '.[$WSP]|.["dir"]' \
|
|
| tr -d '\r'
|
|
)
|
|
LAYOUT=$(cat ${JSON_PATH} \
|
|
| jq -r --arg WSP "${WSP}" '.[$WSP]|.["layout"]' \
|
|
| tr -d '\r'
|
|
)
|
|
|
|
cd "$DIR"
|
|
|
|
LAYOUT_ARGS=$(echo $LAYOUT | grep -oP "(?<=layout ).*(?)")
|
|
echo $LAYOUT_ARGS
|
|
|
|
tmux neww
|
|
if [ ! -z $IS_LAYOUT ]; then
|
|
tmux send-keys "layout '${LAYOUT_ARGS}' '${WPS}'"
|
|
else
|
|
tmux send-keys "${LAYOUT} '${WSP}'" C-m
|
|
fi
|
|
|
|
|
|
|