From 373cbb591a4ecf0a2559c0bbc050a350c3b1871b Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 25 Jun 2023 13:07:08 -0500 Subject: [PATCH] add option to pass container to open as first arg to open-terminal.sh --- open-terminal.sh | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/open-terminal.sh b/open-terminal.sh index 746c140..b2e1b54 100755 --- a/open-terminal.sh +++ b/open-terminal.sh @@ -1,10 +1,19 @@ #!/bin/sh -SEL="$(distrobox list | awk '{if (NR>1) {print $3}}' | rofi -dmenu -p "Select Distrobox ")" -if [ "$SEL" ]; then - echo "selected $SEL" - #distrobox enter "$SEL" - foot -e distrobox enter $SEL --additional-flags "--env TERM=xterm-256color" +open_term() { + foot -e distrobox enter "$1" --additional-flags "--env TERM=xterm-256color" +} + +if [ "$1" ]; then + open_term "$1" else - foot + SEL="$(distrobox list | awk '{if (NR>1) {print $3}}' | rofi -dmenu -p "Select Distrobox ")" + if [ "$SEL" ]; then + echo "selected $SEL" + #distrobox enter "$SEL" + open_term "$SEL" + else + foot + fi + fi