This commit is contained in:
Daniel Napora 2023-05-31 21:44:15 +02:00
parent 48c2883d7f
commit b9b3683aa3
2 changed files with 129 additions and 36 deletions

91
usr/bin/jgclock Executable file
View File

@ -0,0 +1,91 @@
#!/bin/bash
TINT=$(pgrep -a tint2 |cut -d' ' -f4)
case $LANG in
pl*)
CLOCK="Zegar"
CLOCK_LINE1="Zegar linia 1"
CLOCK_LINE2="Zegar linia 2"
NONE="brak"
MSM_TIME_DATE="Ustawienia daty i czasu"
;;
es*)
CLOCK="Clock"
CLOCK_LINE1="Line 1 format"
CLOCK_LINE2="Line 2 format"
NONE="none"
MSM_TIME_DATE="Time and Date settings"
;;
*)
CLOCK="Clock"
CLOCK_LINE1="Line 1 format"
CLOCK_LINE2="Line 2 format"
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)"
out+=("^sep($CLOCK)")
out+=("$CLOCK_LINE1 [ <b> $(date "+${TF1}") </b> ],^checkout(cl1)")
out+=("$CLOCK_LINE2 [ <b> $(date "+${TF2}") </b> ],^checkout(cl2)")
out2+=("^tag(cl1)")
out2+=("^sep($CLOCK_LINE1)")
out2+=("<b>$(date +"%H:%M")</b> <small>(%H:%M)</small>,t2ctl clockline1 '%H:%M' ${TINT};$me")
out2+=("<b>$(date +"%I:%M %p")</b> <small>(%I:%M %p)</small>,t2ctl clockline1 '%I:%M %p' ${TINT};$me")
out2+=("<b>$(date +"%-I:%M %p")</b> <small>(%I-:%M %p)</small>,t2ctl clockline1 '%-I:%M %p' ${TINT};$me")
out2+=("<b>$(date +"%H:%M:%S")</b> <small>(%H:%M:%S)</small>,t2ctl clockline1 '%H:%M:%S' ${TINT};$me")
out2+=("<b>$(date +"%H:%M (%a)")</b> <small>(%H:%M (%a))</small>,t2ctl clockline1 '%H:%M (%a)' ${TINT};$me")
out2+=("^tag(cl2)")
out2+=("^sep($CLOCK_LINE2)")
out2+=("$NONE,t2ctl clockline2 none ${TINT};$me")
out2+=("^sep()")
out2+=("<b>$(date +"%A %d %B")</b> <small>(%A %d %B)</small>,t2ctl clockline2 '%A %d %B' ${TINT};$me")
out2+=("<b>$(date +"%a %d %b")</b> <small>(%a %d %b)</small>,t2ctl clockline2 '%a %d %b' ${TINT};$me")
out2+=("<b>$(date +"%x")</b> <small>(%x)</small>,t2ctl clockline2 '%x' ${TINT};$me")
out2+=("<b>$(date +"%m-%d-%Y")</b> <small>(%m-%d-%Y)</small>,t2ctl clockline2 '%m-%d-%Y' ${TINT};$me")
out2+=("<b>$(date +"%F")</b> <small>(%F)</small>,t2ctl clockline2 '%F' ${TINT};$me")
out2+=("<b>$(date +"%e.%m.%y")</b> <small>(%e.%m.%y)</small>,t2ctl clockline2 '%e.%m.%y' ${TINT};$me")
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 <<EOF > ${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[@]}"

View File

@ -58,8 +58,8 @@ case $LANG in
HORIZONTAL="Poziomo"
VERTICAL="Pionowo"
SPACING="Odstęp"
YES="Tak (1)"
NO="Nie (0)"
YES="Tak"
NO="Nie"
RUNNING_TINT2="Działające Tint2"
DEFAULT_TINT2RC="Domyślny tint2rc"
ADVANCED="Zaawansowane..."
@ -130,8 +130,8 @@ case $LANG in
HORIZONTAL="Horizontal"
VERTICAL="Vertical"
SPACING="Spacing"
YES="Yes (1)"
NO="No (0)"
YES="Yes"
NO="No"
RUNNING_TINT2="Panel(es) en ejecución"
DEFAULT_TINT2RC="Panel tint2rc x defecto"
ADVANCED="Advanced..."
@ -202,8 +202,8 @@ case $LANG in
HORIZONTAL="Horizontal"
VERTICAL="Vertical"
SPACING="Spacing"
YES="Yes (1)"
NO="No (0)"
YES="Yes"
NO="No"
RUNNING_TINT2="Running Tint2"
DEFAULT_TINT2RC="Default tint2rc"
ADVANCED="Advanced..."
@ -243,34 +243,36 @@ qactions () {
out+=("<tt>$(printf "%-20s %20s" "$WIDTH" "[ <b>$H</b> ]")</tt>,^checkout(pheight$i)")
out+=("<tt>$(printf "%-20s %20s" "$MARGIN" "[ <b>$HOR $VERT</b> ]")</tt>,^checkout(pmargin$i)")
out+=("<tt>$(printf "%-20s %20s" "$PADDING" "[ <b>$PHOR $PVERT $SPACE</b> ]")</tt>,^checkout(ppadding$i)")
out+=("<tt>$(printf "%-20s %20s" "$AUTOHIDE" "[ <b>$HIDE</b> ]")</tt>,^checkout(phide$i)")
[[ "$HIDE" == 0 ]] && out+=("<big></big> <tt>$(printf "%-20s %20s" "$AUTOHIDE" "")</tt>,^checkout(phide$i)") || out+=("<big></big> <tt>$(printf "%-20s %20s" "$AUTOHIDE" "")</tt>,^checkout(phide$i)")
out+=("^sep()")
out+=("$ICONS [ <b>$ICONTHEME</b> ],^checkout(iconthemes$i)")
# Clock
if [[ "$PANELITEMS" == *C* ]]; then
read TF1 <<< "$(grep "time1_format" ${TINT} | cut -d'=' -f2)"
read TF2 <<< "$(grep "time2_format" ${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)"
out+=("^sep($CLOCK)")
out+=("$CLOCK_LINE1 [ <b> $(date "+${TF1}") </b> ],^checkout(cl1$i)")
out+=("$CLOCK_LINE2 [ <b> $(date "+${TF2}") </b> ],^checkout(cl2$i)")
out2+=("^tag(cl1$i)")
out2+=("^sep($CLOCK_LINE1)")
out2+=("<b>$(date +"%H:%M")</b> <small>(%H:%M)</small>,t2ctl clockline1 '%H:%M' ${TINT};$me")
out2+=("<b>$(date +"%I:%M %p")</b> <small>(%I:%M %p)</small>,t2ctl clockline1 '%I:%M %p' ${TINT};$me")
out2+=("<b>$(date +"%-I:%M %p")</b> <small>(%I-:%M %p)</small>,t2ctl clockline1 '%-I:%M %p' ${TINT};$me")
out2+=("<b>$(date +"%H:%M:%S")</b> <small>(%H:%M:%S)</small>,t2ctl clockline1 '%H:%M:%S' ${TINT};$me")
#out+=("^sep($CLOCK)")
#out+=("$CLOCK_LINE1 [ <b> $(date "+${TF1}") </b> ],^checkout(cl1$i)")
#out+=("$CLOCK_LINE2 [ <b> $(date "+${TF2}") </b> ],^checkout(cl2$i)")
#out2+=("^tag(cl1$i)")
#out2+=("^sep($CLOCK_LINE1)")
#out2+=("<b>$(date +"%H:%M")</b> <small>(%H:%M)</small>,t2ctl clockline1 '%H:%M' ${TINT};$me")
#out2+=("<b>$(date +"%I:%M %p")</b> <small>(%I:%M %p)</small>,t2ctl clockline1 '%I:%M %p' ${TINT};$me")
#out2+=("<b>$(date +"%-I:%M %p")</b> <small>(%I-:%M %p)</small>,t2ctl clockline1 '%-I:%M %p' ${TINT};$me")
#out2+=("<b>$(date +"%H:%M:%S")</b> <small>(%H:%M:%S)</small>,t2ctl clockline1 '%H:%M:%S' ${TINT};$me")
#out2+=("<b>$(date +"%H:%M (%a)")</b> <small>(%H:%M (%a))</small>,t2ctl clockline1 '%H:%M (%a)' ${TINT};$me")
out2+=("^tag(cl2$i)")
out2+=("^sep($CLOCK_LINE2)")
out2+=("$NONE,t2ctl clockline2 none ${TINT};$me")
out2+=("^sep()")
out2+=("<b>$(date +"%A %d %B")</b> <small>(%A %d %B)</small>,t2ctl clockline2 '%A %d %B' ${TINT};$me")
out2+=("<b>$(date +"%a %d %b")</b> <small>(%a %d %b)</small>,t2ctl clockline2 '%a %d %b' ${TINT};$me")
out2+=("<b>$(date +"%x")</b> <small>(%x)</small>,t2ctl clockline2 '%x' ${TINT};$me")
out2+=("<b>$(date +"%m-%d-%Y")</b> <small>(%m-%d-%Y)</small>,t2ctl clockline2 '%m-%d-%Y' ${TINT};$me")
out2+=("<b>$(date +"%F")</b> <small>(%F)</small>,t2ctl clockline2 '%F' ${TINT};$me")
fi
#out2+=("^tag(cl2$i)")
#out2+=("^sep($CLOCK_LINE2)")
#out2+=("$NONE,t2ctl clockline2 none ${TINT};$me")
#out2+=("^sep()")
#out2+=("<b>$(date +"%A %d %B")</b> <small>(%A %d %B)</small>,t2ctl clockline2 '%A %d %B' ${TINT};$me")
#out2+=("<b>$(date +"%a %d %b")</b> <small>(%a %d %b)</small>,t2ctl clockline2 '%a %d %b' ${TINT};$me")
#out2+=("<b>$(date +"%x")</b> <small>(%x)</small>,t2ctl clockline2 '%x' ${TINT};$me")
#out2+=("<b>$(date +"%m-%d-%Y")</b> <small>(%m-%d-%Y)</small>,t2ctl clockline2 '%m-%d-%Y' ${TINT};$me")
#out2+=("<b>$(date +"%F")</b> <small>(%F)</small>,t2ctl clockline2 '%F' ${TINT};$me")
#out2+=("<b>$(date +"%e.%m.%y")</b> <small>(%e.%m.%y)</small>,t2ctl clockline2 '%e.%m.%y' ${TINT};$me")
#fi
# END Clock
# Taskbar
if [[ "$PANELITEMS" == *T* ]]; then
@ -385,7 +387,10 @@ qactions () {
out2+=("40%,t2ctl width 40% ${TINT};$me")
out2+=("30%,t2ctl width 30% ${TINT};$me")
out2+=("^sep()")
out2+=("<tt>$(printf "%-20s %20s" "$COMPACT" "[ <b>$SHRINK</b> ]")</tt>,^checkout(pcompact$i)")
[[ "$SHRINK" == 0 ]] && out2+=("<big></big> $COMPACT,t2ctl shrink 1 ${TINT};$me ") || out2+=("<big></big> $COMPACT,t2ctl shrink 0 ${TINT};$me")
out2+=("")
out2+=("^tag(pheight$i)")
out2+=("^sep($WIDTH)")
@ -424,14 +429,11 @@ qactions () {
out2+=("1,t2ctl spacing 1 ${TINT};$me")
out2+=("2,t2ctl spacing 2 ${TINT};$me")
out2+=("4,t2ctl spacing 4 ${TINT};$me")
out2+=("^tag(pcompact$i)")
out2+=("^sep($COMPACT)")
out2+=("$NO,t2ctl shrink 0 ${TINT};$me")
out2+=("$YES,t2ctl shrink 1 ${TINT};$me")
out2+=("^tag(phide$i)")
out2+=("^sep($AUTOHIDE)")
out2+=("$NO,t2ctl autohide 0 ${TINT};$me")
out2+=("$YES,t2ctl autohide 1 ${TINT}")
[[ "$HIDE" == 0 ]] && out2+=("<big>綠</big> $NO,t2ctl autohide 0 ${TINT}") || out2+=("<big>祿</big> $NO,t2ctl autohide 0 ${TINT}")
[[ "$HIDE" == 0 ]] && out2+=("<big>祿</big> $YES,t2ctl autohide 1 ${TINT}") || out2+=("<big>綠</big> $YES,t2ctl autohide 1 ${TINT}")
out2+=("^sep($SIZEHIDDEN)")
out2+=("1,t2ctl hideheight 1 ${TINT}")
out2+=("2,t2ctl hideheight 2 ${TINT}")