mirror of
https://github.com/webdev23/shelix.git
synced 2024-08-16 23:40:50 +03:00
61 lines
2.2 KiB
Bash
Executable File
61 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/>. ║
|
|
# ╚-----------------------------------------------------------------------╝
|
|
|
|
|
|
# STDIN=$(cat -)
|
|
|
|
isactive=($(tmux display -p '#{?pane_synchronized,on,off}'))
|
|
editors=($(tmux list-panes -F '#{pane_current_command}'))
|
|
|
|
if [ $isactive == "on" ]; then
|
|
# tmux display "Synchro off"
|
|
for index in "${!editors[@]}"; do
|
|
if [ "${editors[$index]}" != "hx" ]; then
|
|
# Reactive panes
|
|
tmux select-pane -e -t ":.$index"
|
|
fi
|
|
done
|
|
else
|
|
# tmux display "Synchro on"
|
|
for index in "${!editors[@]}"; do
|
|
if [ "${editors[$index]}" != "hx" ]; then
|
|
# Desactive typing on non-editors panes
|
|
tmux select-pane -d -t ":.$index"
|
|
fi
|
|
done
|
|
# Synchronize
|
|
fi
|
|
|
|
|
|
tmux set-window-option synchronize-panes
|
|
|
|
tmux display-message "Synchro-panes is now #{?pane_synchronized,on,off}"
|
|
|
|
# notify "Synchro on"
|
|
|
|
|
|
# Close the popup, if it's one
|
|
if [ -z "$TMUX_PANE" ]; then
|
|
tmux display-popup -C
|
|
fi
|
|
|
|
|
|
|