Skip to content

Commit

Permalink
feat: add an optional second parameter to trigger extrakto with a spe… (
Browse files Browse the repository at this point in the history
#118)

* feat: add an optional second parameter to trigger extrakto with a specific filter temporarily

* feat: define the initial filter via optional second parameter

The previous implementation of this functionallity temporary replaced
the @extrakto_filter_order and restored the original value when
finished.

This is a much more elegant solution

* refactor: use lower for extrakto_inital_mode environment variable
  • Loading branch information
marcdeop authored May 9, 2024
1 parent 2bf2dc7 commit a3d76b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scripts/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ get_next_mode() {

local next=$1
if [ $next == "initial" ]; then
echo ${modes_list[0]}
echo ${extrakto_inital_mode:-${modes_list[0]}}
else
echo ${next_mode[$next]}
fi
Expand Down
7 changes: 6 additions & 1 deletion scripts/open.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ extrakto="$current_dir/extrakto.sh"
pane_id=$1
split_direction=$(get_option "@extrakto_split_direction")

extrakto_inital_mode="$2"
if [[ $split_direction == a ]]; then
if [[ -n $(tmux list-commands popup) ]]; then
split_direction=p
Expand All @@ -26,11 +27,15 @@ if [[ $split_direction == p ]]; then
-h ${popup_height:-$popup_width} \
-x ${popup_x} \
-y ${popup_y:-$popup_x} \
-e extrakto_inital_mode="${extrakto_inital_mode}" \
-E "${extrakto} ${pane_id} popup"
rc=$?
done
exit $rc
else
split_size=$(get_option "@extrakto_split_size")
tmux split-window -${split_direction} -l ${split_size} "tmux setw remain-on-exit off; ${extrakto} ${pane_id} split"
tmux split-window \
-${split_direction} \
-e extrakto_inital_mode="${extrakto_inital_mode}" \
-l ${split_size} "tmux setw remain-on-exit off; ${extrakto} ${pane_id} split"
fi

0 comments on commit a3d76b8

Please sign in to comment.