#!/bin/bash
TINT=$(pgrep -a tint2 |cut -d' ' -f4)
case $LANG in
pl*)
CLOCK="Zegar"
FONT_COLOR="Kolor"
SET_COLOR="Ustaw kolor"
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"
FONT_COLOR="Color"
SET_COLOR="Set color"
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"
FONT_COLOR="Color"
SET_COLOR="Set color"
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"
;;
esac
read PANELITEMS <<< "$(grep "panel_items" ${TINT} | cut -d'=' -f2)"
# Clock
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]}"
read CLR OPA <<< "$(grep "clock_font_color" ${TINT} | cut -d'=' -f2)"
out+=("^sep($CLOCK)")
out+=(" $FONT_COLOR,^checkout(ccolor)")
out2+=("^tag(ccolor)")
out2+=("^sep($SET_COLOR)")
colors=("#ffffff" "#CCCCCC" "#E95420" "#18b0b0" "#3584e4" "#0e8420" "#3dd425" "#c748ba" "#c7162b" "#f4a100" "#333333" "#000000")
for i in "${colors[@]}"
do
out2+=("$i ,t2ctl clockcolor '${i}' ${TINT};me")
done
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 (%a)") (%H:%M (%a)),t2ctl clockline1 '%H:%M (%a)' ${TINT};$me")
out2+=("^tag(cl2)")
out2+=("^sep($CLOCK_LINE2)")
out2+=("$NONE,t2ctl clockline2 none ${TINT};$me")
out2+=("^sep()")
out2+=("$(date +"%A %d %B") (%A %d %B),t2ctl clockline2 '%A %d %B' ${TINT};$me")
out2+=("$(date +"%a %d %b") (%a %d %b),t2ctl clockline2 '%a %d %b' ${TINT};$me")
out2+=("$(date +"%x") (%x),t2ctl clockline2 '%x' ${TINT};$me")
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")
if [ $1 == "ipc" ]; then
. /usr/share/mb-jgtools/pipemenu-standalone.cfg
. $HOME/.config/mabox/mabox.conf
MENU_PADDING_TOP=${jgtools_padding:-0}
MENU_HALIGN="left"
MENU_MARGIN_Y=40
jgmenu_icon_size=0
menu_margin_x=${submenu_spacing:-0}
[ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius
[ -z $jgmenu_use_borders ] && menu_border=0
POSITION_MODE=${1:-fixed}
mkconfigfile
cat < ${MENU_ITEMS}
$(printf '%s\n' "${out[@]}")
$(printf '%s\n' "${out2[@]}")
$(printf '%s\n' "${out3[@]}")
EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
exit 0
fi
printf '%s\n' "${out[@]}"
printf '%s\n' "${out2[@]}"
printf '%s\n' "${out3[@]}"