-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcontainer-open
executable file
·39 lines (34 loc) · 1.03 KB
/
container-open
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
#!/bin/sh
# Copyright (c) 2022 Praveen Kumar S
set -e
# Include config
. $(dirname $0)/containers_config
# If container name is passed choose that else open dmenu prompt
if [ $# -ge 1 ]
then
CONTAINER_NAME="$1"
else
CONTAINER_NAME="$( echo "$(cat $CONTAINER_LIST)" | $DMENU -p $DMENU_PROMPT $DMENU_FLAGS)"
fi
# If URL is selected from hint use that else use the argument if passed
if test $QUTE_MODE = "hints"
then
URL="$QUTE_URL"
else
URL="$2"
fi
# Check if container exists
if container_exists "$CONTAINER_NAME"
then
BASE_DIR="$CONTAINER_BASE/$CONTAINER_NAME"
# Create base dir if it doesn't exist. This can happen for manually created containers
if [ ! -d "$BASE_DIR" ]
then
mkdir "$BASE_DIR"
fi
# Open the given URL in the container. Shows container name in the window title
qutebrowser -B "$BASE_DIR" -C "$CONFIG_FILE" -s window.title_format " {perc}[$CONTAINER_NAME]{title_sep}{current_title}" "$URL"
else
# Send an error if given container doesn't exist
send_msg "error" "Container does not exist. Create using container-add"
fi