mirror of
https://github.com/webdev23/shelix.git
synced 2024-09-11 12:15:28 +03:00
53 lines
2.2 KiB
Bash
Executable File
53 lines
2.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# ╔-----------------------------------------------------------------------╗
|
|
# ║ ║
|
|
# ║ This file is part of the Shelix IDE. ║
|
|
# ║ Copyright (C) 2024 NVRM webdev23 https://github.com/webdev23 ║
|
|
# ║ ║
|
|
# ║ This program is free software: you can redistribute it and/or modify ║
|
|
# ║ it under the terms of the GNU General Public License as published by ║
|
|
# ║ the Free Software Foundation, either version 3 of the License, or ║
|
|
# ║ (at your option) any later version. ║
|
|
# ║ ║
|
|
# ║ This program is distributed in the hope that it will be useful, ║
|
|
# ║ but WITHOUT ANY WARRANTY; without even the implied warranty of ║
|
|
# ║ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ║
|
|
# ║ GNU General Public License for more details. ║
|
|
# ║ ║
|
|
# ║ You should have received a copy of the GNU General Public License ║
|
|
# ║ along with this program. If not, see <http://www.gnu.org/licenses/>. ║
|
|
# ╚-----------------------------------------------------------------------╝
|
|
|
|
|
|
# First check if no runninng instances
|
|
# running=($(tmux list-panes -F '#{pane_current_command}'))
|
|
|
|
# iseditor="0"
|
|
# for index in "${!running[@]}"; do
|
|
# if [ "${running[$index]}" = "hx" ]; then
|
|
# iseditor="1"
|
|
# fi
|
|
# done
|
|
|
|
# Either the window has no running Helix
|
|
# Or the command is ran from a popup
|
|
if [ $(has_editor) == "0" ] || [ -z "$TMUX_PANE" ];then
|
|
# notify "IS NOT EDITOR"
|
|
# We split the current pane in focus
|
|
tmux split-window -h
|
|
tmux select-pane -T hx # Pane title
|
|
tmux send-keys "hx" Enter # Run hx
|
|
tmux popup -C # force close popup, if any
|
|
else
|
|
# Check if a pane is marked
|
|
MARKED=$(tmux display -p -t '~' '#D')
|
|
if [ -z "$MARKED" ]; then
|
|
tmux split-window -t $(to_last_hx) -h
|
|
else
|
|
tmux split-window -t '~' -h
|
|
fi
|
|
|
|
tmux select-pane -T hx # Pane title
|
|
tmux send-keys "hx" Enter # Run hx
|
|
fi
|