From 21543769e3778f9e1cbdc7fdc5df127a3963aaa8 Mon Sep 17 00:00:00 2001 From: Daniel Napora Date: Fri, 2 Jun 2023 21:33:41 +0200 Subject: [PATCH] jgclock --- usr/bin/jgclock | 58 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 47 insertions(+), 11 deletions(-) diff --git a/usr/bin/jgclock b/usr/bin/jgclock index 7ccfd85..9d476df 100755 --- a/usr/bin/jgclock +++ b/usr/bin/jgclock @@ -5,22 +5,37 @@ TINT=$(pgrep -a tint2 |cut -d' ' -f4) case $LANG in pl*) CLOCK="Zegar" - CLOCK_LINE1="Zegar linia 1" - CLOCK_LINE2="Zegar linia 2" + CLOCK_LINE1="Linia 1" + CLOCK_LINE2="Linia 2" + FORMAT="Format" + FONT="Czcionka" + INCREASE="Powiększ" + DECREASE="Pomniejsz" + SETFONT="Ustaw wybraną czcionkę..." NONE="brak" MSM_TIME_DATE="Ustawienia daty i czasu" ;; es*) CLOCK="Clock" - CLOCK_LINE1="Line 1 format" - CLOCK_LINE2="Line 2 format" + CLOCK_LINE1="Line 1" + CLOCK_LINE2="Line 2" + FORMAT="Format" + FONT="Font" + INCREASE="Increase" + DECREASE="Decrease" + SETFONT="Set custom font..." NONE="none" MSM_TIME_DATE="Time and Date settings" ;; *) CLOCK="Clock" - CLOCK_LINE1="Line 1 format" - CLOCK_LINE2="Line 2 format" + CLOCK_LINE1="Line 1" + CLOCK_LINE2="Line 2" + FORMAT="Format" + FONT="Font" + INCREASE="Increase" + DECREASE="Decrease" + SETFONT="Set custom font..." NONE="none" MSM_TIME_DATE="Time and Date settings" ;; @@ -31,16 +46,25 @@ read PANELITEMS <<< "$(grep "panel_items" ${TINT} | cut -d'=' -f2)" if [[ "$PANELITEMS" == *C* ]]; then read TF1 <<< "$(grep "time1_format" ${TINT} | cut -d'=' -f2)" read TF2 <<< "$(grep "time2_format" ${TINT} | cut -d'=' -f2)" +read -a FL1 <<< "$(grep "time1_font" ${TINT} | cut -d'=' -f2)" +L1_FONT="${FL1[@]::${#FL1[@]}-1}" # this is crazy... all array elements but last +L1_SIZE="${FL1[-1]}" +read -a FL2 <<< "$(grep "time2_font" ${TINT} | cut -d'=' -f2)" +L2_FONT="${FL2[@]::${#FL2[@]}-1}" # this is crazy... all array elements but last +L2_SIZE="${FL2[-1]}" -out+=("^sep($CLOCK)") -out+=("$CLOCK_LINE1 [ $(date "+${TF1}") ],^checkout(cl1)") -out+=("$CLOCK_LINE2 [ $(date "+${TF2}") ],^checkout(cl2)") +out+=("^sep($CLOCK $CLOCK_LINE1)") +out+=("$FORMAT: [ $(date "+${TF1}") ],^checkout(cl1)") +out+=("$FONT: [ $L1_FONT $L1_SIZE ],^checkout(fl1)") +out+=("^sep($CLOCK $CLOCK_LINE2)") +[[ "$TF2" == "" ]] && out+=("$FORMAT: [ $NONE ],^checkout(cl2)")|| out+=("$FORMAT: [ $(date "+${TF2}") ],^checkout(cl2)") +out+=("$FONT: $L2_FONT $L2_SIZE,^checkout(fl2)") out2+=("^tag(cl1)") out2+=("^sep($CLOCK_LINE1)") out2+=("$(date +"%H:%M") (%H:%M),t2ctl clockline1 '%H:%M' ${TINT};$me") +out2+=("$(date +"%H:%M:%S") (%H:%M:%S),t2ctl clockline1 '%H:%M:%S' ${TINT};$me") out2+=("$(date +"%I:%M %p") (%I:%M %p),t2ctl clockline1 '%I:%M %p' ${TINT};$me") out2+=("$(date +"%-I:%M %p") (%I-:%M %p),t2ctl clockline1 '%-I:%M %p' ${TINT};$me") -out2+=("$(date +"%H:%M:%S") (%H:%M:%S),t2ctl clockline1 '%H:%M:%S' ${TINT};$me") out2+=("$(date +"%H:%M (%a)") (%H:%M (%a)),t2ctl clockline1 '%H:%M (%a)' ${TINT};$me") out2+=("^tag(cl2)") @@ -53,9 +77,21 @@ out2+=("$(date +"%x") (%x),t2ctl clockline2 '%x' ${TINT};$ out2+=("$(date +"%m-%d-%Y") (%m-%d-%Y),t2ctl clockline2 '%m-%d-%Y' ${TINT};$me") out2+=("$(date +"%F") (%F),t2ctl clockline2 '%F' ${TINT};$me") out2+=("$(date +"%e.%m.%y") (%e.%m.%y),t2ctl clockline2 '%e.%m.%y' ${TINT};$me") +out2+=("^tag(fl1)") +out2+=("^sep($L1_FONT $L1_SIZE)") +out2+=("󰧴 $INCREASE ( $((L1_SIZE+1)) ),t2ctl clock1_fontsize $((L1_SIZE+1)) ${TINT};$me") +out2+=("󰧳 $DECREASE ( $((L1_SIZE-1)) ),t2ctl clock1_fontsize $((L1_SIZE-1)) ${TINT};$me") +out2+=("^sep()") +out2+=("󰛖 $SETFONT,mb-setfont t2_time1_font ${TINT}") +out2+=("^tag(fl2)") +out2+=("^sep($L2_FONT $L2_SIZE)") +out2+=("󰧴 $INCREASE ( $((L2_SIZE+1)) ),t2ctl clock2_fontsize $((L2_SIZE+1)) ${TINT};$me") +out2+=("󰧳 $DECREASE ( $((L2_SIZE-1)) ),t2ctl clock2_fontsize $((L2_SIZE-1)) ${TINT};$me") +out2+=("^sep()") +out2+=("󰛖 $SETFONT,mb-setfont t2_time2_font ${TINT}") fi out+=("^sep()") -out+=("$MSM_TIME_DATE,manjaro-settings-manager -m msm_timedate") +out+=("󰅐 $MSM_TIME_DATE,manjaro-settings-manager -m msm_timedate") if [ $1 == "ipc" ]; then