Skip to content

Commit

Permalink
temporalilly disable synchronize panes to type in fzf only
Browse files Browse the repository at this point in the history
Signed-off-by: Romain Perez <[email protected]>
  • Loading branch information
rohm1 committed Aug 20, 2024
1 parent bb1bbd2 commit cba2828
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scripts/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ main() {
local selected_item_name
local selected_item_uuid
local selected_item_password
local synchronize_panes_reset_value

local -ra fzf_opts=(
--no-multi
Expand All @@ -48,8 +49,12 @@ main() {
items="$(op::get_all_items)"
spinner::stop

synchronize_panes_reset_value=$(tmux::disable_synchronize_panes)

selected_item="$(echo "$items" | awk -F ',' '{ print $1 }' | fzf "${fzf_opts[@]}")"

tmux::set_synchronize_panes "${synchronize_panes_reset_value}"

if [[ -n "$selected_item" ]]; then
selected_item_name=${selected_item#*,}
selected_item_uuid="$(echo "$items" | grep "^$selected_item_name," | awk -F ',' '{ print $2 }')"
Expand Down
13 changes: 13 additions & 0 deletions scripts/utils/tmux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,16 @@ tmux::get_option() {
tmux::display_message() {
tmux display-message "tmux-1password: $1"
}

tmux::disable_synchronize_panes() {
if [ "$(tmux show-options -wv synchronize-panes)" == "on" ]; then
tmux::set_synchronize_panes "off"
echo "on"
else
echo "off"
fi
}

tmux::set_synchronize_panes() {
tmux set-window-option synchronize-panes "${1}"
}

0 comments on commit cba2828

Please sign in to comment.