-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathpane_move.sh
executable file
·75 lines (61 loc) · 2.14 KB
/
pane_move.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/sh
#
# Copyright (c) 2022-2025: [email protected]
# License: MIT
#
# Part of https://github.com/jaclu/tmux-menus
#
# Move a pane
#
dynamic_content() {
# clear params content
set --
tmux_vers_check 3.0 && {
# marking a pane is an ancient feature, but pane_marked came at 3.0
$TMUX_BIN display-message -p \
'#{&&:#{pane_marked_set},#{!=:#{pane_marked},1}}' | grep -q 1 && {
set -- \
3.0 C m "Swap current pane with marked" "swap-pane $menu_reload"
}
}
menu_generate_part 2 "$@" # needs to be generated even if empty, to keep an item 2
}
static_content() {
menu_segment=1
set -- \
0.0 M Left "Back to Handling Pane $nav_prev" panes.sh \
0.0 M Home "Back to Main menu $nav_home" main.sh \
1.7 S
menu_generate_part "$menu_segment" "$@"
menu_segment=$((menu_segment + 2)) # increment past dynamic segment
set -- \
1.7 C p "Swap pane with prev" "swap-pane -U $menu_reload" \
1.7 C n "Swap pane with next" "swap-pane -D $menu_reload" \
1.7 S \
2.4 E w "Break pane off to a new window" "$d_scripts/break_pane.sh" \
1.7 E o "Move to other win/ses" "$d_scripts/act_choose_tree.sh P M"
menu_generate_part "$menu_segment" "$@"
menu_segment=$((menu_segment + 1))
$cfg_use_hint_overlays && $cfg_show_key_hints && {
set -- \
1.7 M K "Key hints - Move to other $nav_next" \
"$d_hints/choose-tree.sh $f_current_script"
menu_generate_part "$menu_segment" "$@"
menu_segment=$((menu_segment + 1))
}
set -- \
0.0 S \
1.7 M H "Help, explaining move $nav_next" \
"$d_help/help_pane_move.sh $f_current_script"
menu_generate_part "$menu_segment" "$@"
}
#===============================================================
#
# Main
#
#===============================================================
menu_name="Move Pane"
# Full path to tmux-menux plugin
D_TM_BASE_PATH="$(dirname -- "$(dirname -- "$(realpath "$0")")")"
# shellcheck source=scripts/dialog_handling.sh
. "$D_TM_BASE_PATH"/scripts/dialog_handling.sh