dynamic menu HEIGHT & CHOICE_HEIGHT

This commit is contained in:
rootzoll 2021-08-16 16:41:23 +02:00
parent b34d409f02
commit 216cd98c0a
8 changed files with 22 additions and 53 deletions

@ -178,7 +178,7 @@ OPTIONS+=(REBOOT "Reboot RaspiBlitz")
OPTIONS+=(OFF "PowerOff RaspiBlitz")
CHOICE_HEIGHT=$(("${#OPTIONS[@]}"))
CHOICE_HEIGHT=$(("${#OPTIONS[@]}/2+1"))
HEIGHT=$((CHOICE_HEIGHT+6))
CHOICE=$(dialog --clear \
--backtitle "$BACKTITLE" \

@ -37,9 +37,7 @@ fi
source <(/home/admin/config.scripts/internet.sh status local)
# BASIC MENU INFO
HEIGHT=10
WIDTH=64
CHOICE_HEIGHT=3
BACKTITLE="${CHAIN} options"
TITLE=""
MENU="Choose one of the following options:"
@ -59,56 +57,44 @@ if [ $chain = test ]&&[ "$trtlWebinterface" = "on" ]||\
[ $chain = sig ]&& [ "$srtlWebinterface" = "on" ]||\
[ $chain = main ]&&[ "$rtlWebinterface" = "on" ]; then
OPTIONS+=(RTL "RTL Web Node Manager for LND ${CHAIN}")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
fi
if [ $chain = test ]&&[ "$tlnd" = "on" ]||\
[ $chain = sig ]&& [ "$slnd" = "on" ]||\
[ $chain = main ]&&[ "$lnd" = "on" ]; then
OPTIONS+=(LND "LND options for ${CHAIN}")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
fi
if [ "$chain" = "test" ]&&[ "$tcrtlWebinterface" = "on" ]||\
[ "$chain" = "sig" ]&& [ "$scrtlWebinterface" = "on" ]||\
[ "$chain" = "main" ]&&[ "$crtlWebinterface" = "on" ]; then
OPTIONS+=(cRTL "RTL Web Node Manager for C-lightning ${CHAIN}")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
fi
if [ "$chain" = "test" ]&&[ "$tcln" = "on" ]||\
[ "$chain" = "sig" ]&& [ "$scln" = "on" ]||\
[ "$chain" = "main" ]&&[ "$cln" = "on" ]; then
OPTIONS+=(CLN "C-lightning options for ${CHAIN}")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
fi
OPTIONS+=(INFO "RaspiBlitz Status Screen for ${CHAIN}")
if [ "$testnet" == "on" ]; then
OPTIONS+=(SERVICES "Additional Apps & Services on ${CHAIN}")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
OPTIONS+=(SERVICES "Additional Apps & Services on ${CHAIN}")
fi
OPTIONS+=(SYSTEM "Monitoring & Configuration")
#TODO OPTIONS+=(CONNECT "Connect Apps & Show Credentials")
if [ $nonDefaultLNtype = 1 ];then
OPTIONS+=(SWITCHLN "Make ${LNTYPE} the default lightning wallet")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
fi
if [ $nonDefaultChain = 1 ];then
OPTIONS+=(MKDEFAULT "Make ${CHAIN} the default chain")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
fi
CHOICE_HEIGHT=$(("${#OPTIONS[@]}/2+1"))
HEIGHT=$((CHOICE_HEIGHT+6))
CHOICE=$(dialog --clear \
--backtitle "$BACKTITLE" \
--title "$TITLE" \

@ -105,8 +105,9 @@ if [ ${chain} = "main" ];then
fi
fi
CHOICE_HEIGHT=$(("${#OPTIONS[@]}"))
CHOICES=$(dialog --title ' Node Settings & Options ' --checklist ' use spacebar to activate/de-activate ' $CHOICE_HEIGHT 45 $CHOICE_HEIGHT "${OPTIONS[@]}" 2>&1 >/dev/tty)
CHOICE_HEIGHT=$(("${#OPTIONS[@]}/2+1"))
HEIGHT=$((CHOICE_HEIGHT+6))
CHOICES=$(dialog --title ' Node Settings & Options ' --checklist ' use spacebar to activate/de-activate ' $HEIGHT 45 $CHOICE_HEIGHT "${OPTIONS[@]}" 2>&1 >/dev/tty)
dialogcancel=$?
clear

@ -11,9 +11,7 @@ source <(/home/admin/config.scripts/network.aliases.sh getvars cln $1)
source <(/home/admin/config.scripts/internet.sh status local)
# BASIC MENU INFO
HEIGHT=14
WIDTH=64
CHOICE_HEIGHT=8
BACKTITLE="RaspiBlitz"
TITLE="C-Lightning Options"
MENU=""
@ -32,20 +30,18 @@ ln_channels_online="$(echo "${ln_getInfo}" | jq -r '.num_active_channels')" 2>/d
cln_num_inactive_channels="$(echo "${ln_getInfo}" | jq -r '.num_inactive_channels')" 2>/dev/null
openChannels=$((ln_channels_online+cln_num_inactive_channels))
if [ ${#openChannels} -gt 0 ] && [ ${openChannels} -gt 0 ]; then
OPTIONS+=(SUEZ "Visualize channels")
OPTIONS+=(CLOSEALL "Close all open Channels on $CHAIN")
HEIGHT=$((HEIGHT+2))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+2))
OPTIONS+=(SUEZ "Visualize channels")
OPTIONS+=(CLOSEALL "Close all open Channels on $CHAIN")
fi
if [ ${#LNdefault} -gt 0 ]&&[ $LNdefault = lnd ];then
OPTIONS+=(SWITCHLN "Use C-lightning as default")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
fi
OPTIONS+=(CASHOUT "Withdraw all funds from C-lightning on $CHAIN")
CHOICE_HEIGHT=$(("${#OPTIONS[@]}/2+1"))
HEIGHT=$((CHOICE_HEIGHT+6))
CHOICE=$(dialog --clear \
--backtitle "$BACKTITLE" \
--title "$TITLE" \

@ -9,9 +9,7 @@ source /mnt/hdd/raspiblitz.conf
source <(/home/admin/config.scripts/internet.sh status local)
# BASIC MENU INFO
HEIGHT=12
WIDTH=64
CHOICE_HEIGHT=6
BACKTITLE="RaspiBlitz"
TITLE="Connect Options"
MENU=""
@ -20,13 +18,9 @@ OPTIONS=()
OPTIONS+=(MOBILE "Connect Mobile Wallet")
if [ "${ElectRS}" == "on" ]; then
OPTIONS+=(ELECTRS "Electrum Rust Server")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
fi
if [ "${BTCPayServer}" == "on" ]; then
OPTIONS+=(BTCPAY "Show LND connection string")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
fi
OPTIONS+=(${network}RPC "Connect Specter Desktop or JoinMarket")
OPTIONS+=(BISQ "Connect Bisq to this node")
@ -34,6 +28,8 @@ OPTIONS+=(EXPORT "Get Macaroons and TLS.cert")
OPTIONS+=(RESET "Recreate LND Macaroons & tls.cert")
OPTIONS+=(SYNC "Sync Macaroons & tls.cert with Apps/Users")
CHOICE_HEIGHT=$(("${#OPTIONS[@]}/2+1"))
HEIGHT=$((CHOICE_HEIGHT+6))
CHOICE=$(dialog --clear \
--backtitle "$BACKTITLE" \
--title "$TITLE" \

@ -11,9 +11,7 @@ source <(/home/admin/config.scripts/internet.sh status local)
source <(/home/admin/config.scripts/network.aliases.sh getvars lnd $1)
# BASIC MENU INFO
HEIGHT=13
WIDTH=64
CHOICE_HEIGHT=7
BACKTITLE="RaspiBlitz"
TITLE="Lightning Options"
MENU=""
@ -29,27 +27,23 @@ if [ "${chain}" = "main" ]; then
OPTIONS+=(lnbalance "Detailed Wallet Balances")
OPTIONS+=(lnchannels "Lightning Channel List")
OPTIONS+=(lnfwdreport "Lightning Forwarding Events Report")
HEIGHT=$((HEIGHT+3))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+3))
fi
OPTIONS+=(NAME "Change Name/Alias of Node")
openChannels=$($lncli_alias listchannels 2>/dev/null | jq '.[] | length')
if [ ${#openChannels} -gt 0 ] && [ ${openChannels} -gt 0 ]; then
OPTIONS+=(SUEZ "Visualize channels")
OPTIONS+=(CLOSEALL "Close all open Channels on $CHAIN")
HEIGHT=$((HEIGHT+2))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+2))
OPTIONS+=(SUEZ "Visualize channels")
OPTIONS+=(CLOSEALL "Close all open Channels on $CHAIN")
fi
OPTIONS+=(CASHOUT "Withdraw all funds from LND on $CHAIN")
if [ ${#LNdefault} -gt 0 ]&&[ $LNdefault = cln ];then
OPTIONS+=(SWITCHLN "Use LND as default")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
fi
CHOICE_HEIGHT=$(("${#OPTIONS[@]}/2+1"))
HEIGHT=$((CHOICE_HEIGHT+6))
CHOICE=$(dialog --clear \
--backtitle "$BACKTITLE" \
--title "$TITLE" \

@ -9,9 +9,7 @@ source /mnt/hdd/raspiblitz.conf
source <(/home/admin/config.scripts/network.aliases.sh getvars cln $1)
# BASIC MENU INFO
HEIGHT=12 # add 6 to CHOICE_HEIGHT + MENU lines
WIDTH=64
CHOICE_HEIGHT=6 # 1 line / OPTIONS
BACKTITLE="RaspiBlitz"
TITLE="${CHAIN} System Options"
MENU="" # adds lines to HEIGHT
@ -25,18 +23,18 @@ OPTIONS+=(LNDCONF "Edit the lnd.conf for ${CHAIN}")
if grep "^${netprefix}cln=on" /mnt/hdd/raspiblitz.conf;then
OPTIONS+=(CLNLOG "Monitor the CLN log for ${CHAIN}")
OPTIONS+=(CLNCONF "Edit the CLN config for ${CHAIN}")
HEIGHT=$((HEIGHT+2))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+2))
fi
if [ "${runBehindTor}" == "on" ]; then
OPTIONS+=(TORLOG "Monitor the Tor Service with Nyx")
OPTIONS+=(TORRC "Edit the Tor Configuration")
HEIGHT=$((HEIGHT+2))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+2))
fi
OPTIONS+=(CUSTOMLOG "Monitor a custom service")
OPTIONS+=(CUSTOMRESTART "Restart a custom service")
CHOICE_HEIGHT=$(("${#OPTIONS[@]}/2+1"))
HEIGHT=$((CHOICE_HEIGHT+6))
CHOICE=$(dialog --clear \
--backtitle "$BACKTITLE" \
--title "$TITLE" \

@ -373,9 +373,7 @@ if [ "$1" == "github" ]; then
fi
# Basic Options Menu
HEIGHT=10 # add 6 to CHOICE_HEIGHT + MENU lines
WIDTH=55
CHOICE_HEIGHT=4 # 1 line / OPTIONS
OPTIONS=()
OPTIONS+=(RELEASE "RaspiBlitz Release Update/Recovery")
OPTIONS+=(PATCH "Patch RaspiBlitz v${codeVersion}")
@ -417,7 +415,7 @@ if [ "${runBehindTor}" == "on" ]; then
OPTIONS+=(TOR "Update Tor from the source code")
fi
CHOICE_HEIGHT=$(("${#OPTIONS[@]}"))
CHOICE_HEIGHT=$(("${#OPTIONS[@]}/2+1"))
HEIGHT=$((CHOICE_HEIGHT+6))
CHOICE=$(dialog --clear \
--backtitle "" \