27 lines
637 B
Bash
Executable File
27 lines
637 B
Bash
Executable File
#!/usr/bin/zsh
|
|
# Runs the IDE
|
|
|
|
PARAMS=$@
|
|
SESSIONID="IDE-${RANDOM}"
|
|
MUX=$(where tmux)
|
|
|
|
# Set editor to helix, if unset
|
|
if [[ -v EDITOR ]]; then
|
|
EDITOR=$(where hx)
|
|
fi
|
|
|
|
# Open a new session with a random name
|
|
$MUX new-session -d -s $SESSIONID -x "$(tput cols)" -y "$(tput lines)" $EDITOR $PARAMS
|
|
$MUX rename-window -t ${SESSIONID}:0 "TMUX IDE"
|
|
|
|
# check, if a layout file is present, and run it.
|
|
if [ -f ./.layout.tmux ]; then
|
|
source ./.layout.tmux
|
|
fi
|
|
|
|
# Finally, select the editor window in the current session,
|
|
# and attach to the session
|
|
$MUX select-window -t ${SESSIONID}:0
|
|
$MUX select-pane -t 0
|
|
$MUX attach-session -t ${SESSIONID}
|