-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathselect_ff_tab.sh
More file actions
executable file
·39 lines (29 loc) · 1.08 KB
/
Copy pathselect_ff_tab.sh
File metadata and controls
executable file
·39 lines (29 loc) · 1.08 KB
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
#!/bin/bash
# Based on https://man.archlinux.org/man/community/rofi/rofi-script.5.en
# Use by calling this: rofi -show tabs -modes "tabs:select_ff_tab.sh"
if ((ROFI_RETV == 0)); then
tab_list=$(bt list | tr '\t' ' ')
tab_list_base64=$(echo "$tab_list" | base64 -w 0)
echo -en "\0data\x1f$tab_list_base64\n"
else
tab_list=$(echo "$ROFI_DATA" | base64 -d)
fi
if [[ "$@" != "" ]]; then
sel_tab=$(echo "$@" | sed 's/ $//g')
tab_id=$(echo "$tab_list" | grep -m1 "$sel_tab" | awk '{print $1}')
bt activate --focused "$tab_id"
# if ! [ -z "$sel_tab" ]; then
# tab_id=$(echo "$tab_list" | grep -m1 "$sel_tab" | awk '{print $1}')
# bt activate --focused "$tab_id"
# fi
exit 0
fi
tab_list_clean=$(echo "$tab_list" | awk '{for (i = 2; i <= NF; i++) {printf "%s ", $i}; printf "\n"}')
# Output list to rofi
echo "$tab_list_clean"
# awk '{$1=""; print $0}')
# sel_tab=$(echo "$tab_list_clean" | rofi -dmenu -p "Select firefox tab")
# if ! [ -z "$sel_tab" ]; then
# tab_id=$(echo "$tab_list" | grep -m1 "$sel_tab" | awk '{print $1}')
# bt activate --focused "$tab_id"
# fi