From 3f14b2cce01c070559d58ebac4372fbe04a3ae52 Mon Sep 17 00:00:00 2001 From: Chris Bosse <30784811+chrisBosse@users.noreply.github.com> Date: Tue, 28 Apr 2020 15:08:36 -0400 Subject: [PATCH] Add Dual VFO to Conky This refers to km4ack/pi-build#61 --- conky/.conkyrc | 4 ++++ conky/conky-large | 4 ++++ conky/conky-medium | 4 ++++ conky/conky-small | 4 ++++ conky/get-freq | 28 +++++++++++++++++++++++----- conky/get-vfo | 22 ++++++++++++++++++++++ 6 files changed, 61 insertions(+), 5 deletions(-) create mode 100755 conky/get-vfo diff --git a/conky/.conkyrc b/conky/.conkyrc index 776ecf7..5018369 100644 --- a/conky/.conkyrc +++ b/conky/.conkyrc @@ -34,6 +34,10 @@ ${font Arial:size=30}${color Yellow}${alignc}N0CALL ${voffset -45} ${font Arial:bold:size=18}${color White}Gridsquare ${alignr}${color Yellow}${execi 25 $HOME/bin/conky/grid | cut -c1-8} #${font Arial:bold:size=18}${color White}Radio Freq ${alignr}${color Yellow}${execi 5 $HOME/bin/conky/get-freq | cut -c1-6} +#${font Arial:bold:size=18}${color White}Radio Freq A ${if_match "VFOA" == "${execi 5 $HOME/bin/conky/get-vfo}"}*$endif\ +#${alignr}${color Yellow}${execi 5 $HOME/bin/conky/get-freq VFOA | cut -c1-7} +#${font Arial:bold:size=18}${color White}Radio Freq B ${if_match "VFOB" == "${execi 5 $HOME/bin/conky/get-vfo}"}*$endif\ +#${alignr}${color Yellow}${execi 5 $HOME/bin/conky/get-freq VFOB | cut -c1-7} ${color Yellow}LOCAL${alignr}ZULU ${voffset -45} diff --git a/conky/conky-large b/conky/conky-large index b85fbd0..365562d 100644 --- a/conky/conky-large +++ b/conky/conky-large @@ -34,6 +34,10 @@ ${font Arial:size=30}${color Yellow}${alignc}N0CALL ${voffset -45} ${font Arial:bold:size=18}${color White}Gridsquare ${alignr}${color Yellow}${execi 25 $HOME/bin/conky/grid | cut -c1-8} #${font Arial:bold:size=18}${color White}Radio Freq ${alignr}${color Yellow}${execi 5 $HOME/bin/conky/get-freq | cut -c1-6} +#${font Arial:bold:size=18}${color White}Radio Freq A ${if_match "VFOA" == "${execi 5 $HOME/bin/conky/get-vfo}"}*$endif\ +#${alignr}${color Yellow}${execi 5 $HOME/bin/conky/get-freq VFOA | cut -c1-7} +#${font Arial:bold:size=18}${color White}Radio Freq B ${if_match "VFOB" == "${execi 5 $HOME/bin/conky/get-vfo}"}*$endif\ +#${alignr}${color Yellow}${execi 5 $HOME/bin/conky/get-freq VFOB | cut -c1-7} ${color Yellow}LOCAL${alignr}ZULU ${voffset -45} diff --git a/conky/conky-medium b/conky/conky-medium index b78787b..d410afa 100644 --- a/conky/conky-medium +++ b/conky/conky-medium @@ -33,6 +33,10 @@ ${font Arial:size=18}${color Yellow}${alignc}N0CALL ${voffset -25} ${font Arial:bold:size=12}${color White}Gridsquare ${alignr}${color Yellow}${execi 25 $HOME/bin/conky/grid | cut -c1-8} #${font Arial:bold:size=12}${color White}Radio Freq ${alignr}${color Yellow}${execi 5 $HOME/bin/conky/get-freq | cut -c1-6} +#${font Arial:bold:size=12}${color White}Radio Freq A ${if_match "VFOA" == "${execi 5 $HOME/bin/conky/get-vfo}"}*$endif\ +#${alignr}${color Yellow}${execi 5 $HOME/bin/conky/get-freq VFOA | cut -c1-7} +#${font Arial:bold:size=12}${color White}Radio Freq B ${if_match "VFOB" == "${execi 5 $HOME/bin/conky/get-vfo}"}*$endif\ +#${alignr}${color Yellow}${execi 5 $HOME/bin/conky/get-freq VFOB | cut -c1-7} ${color Yellow}LOCAL${alignr}ZULU ${color DarkSlateGray}${hr 2} ${font Arial:bold:size=15}${color White}${time %H:%M:%S}\ diff --git a/conky/conky-small b/conky/conky-small index d338022..5105a2c 100644 --- a/conky/conky-small +++ b/conky/conky-small @@ -33,6 +33,10 @@ ${font Arial:size=12}${color Yellow}${alignc}N0CALL ${voffset -20} ${font Arial:bold:size=08}${color White}Gridsquare ${alignr}${color Yellow}${execi 25 $HOME/bin/conky/grid | cut -c1-8} #${font Arial:bold:size=12}${color White}Radio Freq ${alignr}${color Yellow}${execi 5 $HOME/bin/conky/get-freq | cut -c1-6} +#${font Arial:bold:size=12}${color White}Radio Freq A ${if_match "VFOA" == "${execi 5 $HOME/bin/conky/get-vfo}"}*$endif\ +#${alignr}${color Yellow}${execi 5 $HOME/bin/conky/get-freq VFOA | cut -c1-7} +#${font Arial:bold:size=12}${color White}Radio Freq B ${if_match "VFOB" == "${execi 5 $HOME/bin/conky/get-vfo}"}*$endif\ +#${alignr}${color Yellow}${execi 5 $HOME/bin/conky/get-freq VFOB | cut -c1-7} ${color Yellow}LOCAL${alignr}ZULU ${voffset -20} ${color DarkSlateGray}${hr 2} diff --git a/conky/get-freq b/conky/get-freq index fb7b7b5..edadb58 100644 --- a/conky/get-freq +++ b/conky/get-freq @@ -1,22 +1,40 @@ #!/bin/bash #get freq of radio to display in conky +#optional parameter: VFOA VFOB #20191217 km4ack +#20200428 modified source $HOME/patmenu2/config MAIN () { -FREQ=$($RIG f) -FREQCH=$(echo $FREQ | grep error) +# If first argument, $1, is empty or unset, use 'VFOA' as its value. +VFO=${1:-'VFOA'} + +FREQ=$($RIG -o f "$VFO") +FREQCH=$(echo "$FREQ" | grep error) if [ -z "$FREQCH" ] then -echo $FREQ +HZ_TO_MHZ "$FREQ" else -MAIN +MAIN "$1" fi } -MAIN \ No newline at end of file +HZ_TO_MHZ () { + +#Inject decimal into number six places from right. +#First, and only, parameter expected to be a string of six or more digits + +DP=. +SIX_DIGITS='[0-9][0-9][0-9][0-9][0-9][0-9]' +MHZ="${1%%$SIX_DIGITS}" +HZ="${1##$MHZ}" +printf "%s$DP%s\n" "$MHZ" "$HZ" + +} + +MAIN "$1" diff --git a/conky/get-vfo b/conky/get-vfo new file mode 100755 index 0000000..eaf4580 --- /dev/null +++ b/conky/get-vfo @@ -0,0 +1,22 @@ +#!/bin/bash + +#get VFO of radio to display in conky +#20200428 + +source "$HOME/patmenu/config" + +MAIN () { + +VFO=$($RIG v) +VFOCH=$(echo "$VFO" | grep error) + +if [ -z "$VFOCH" ] +then +echo "$VFO" +else +MAIN +fi + +} + +MAIN