copy i3status.conf file to your .config path (~/.config/i3status/config)
mkdir ~/.config/i3status
cp /etc/i3status.conf ~/.config/i3status/config
update config file to allow json output (also add your desired changes here):
general {
output_format = i3bar // add this line
colors = true
interval = 5
}
next create your wrapper script with following content (i put it on ~/.config/i3status/wrapper.sh):
#!/bin/bash
i3status | while read -r line; do
# Step 1: Forward header line
if [[ "$line" =~ ^\{ ]]; then
echo "$line"
continue
fi
# Step 2: Forward array start line
if [[ "$line" == "[" ]]; then
echo "$line"
continue
fi
jalali_date=$(jdate +'%Y-%m-%d') # make sure to install required commands if required. for this to work u have to install 'jcal' package
# Build a JSON object for your custom block
custom_block="{\"full_text\":\"$jalali_date\",\"color\":\"#ffffff\"}"
# Insert your block before the rest
echo "${line%]}, $custom_block]"
donenext tell i3 to use your wrapper script (edit ~/.config/i3/config file):
bar {
status_command ~/.config/i3status/wrapper.sh
}
now restart i3 ... DONE!
if u want indicator on the left use this script:
#!/bin/bash
i3status | while read -r line; do
# Step 1: Forward header line
if [[ "$line" =~ ^\{ ]]; then
echo "$line"
continue
fi
# Step 2: Forward array start line
if [[ "$line" == "[" ]]; then
echo "$line"
continue
fi
# Step 3: Process status entries
# Remove leading comma if present
if [[ "$line" =~ ^, ]]; then
prefix=","
line="${line#,}"
else
prefix=""
fi
jalali_date=$(jdate +'%Y-%m-%d')
# Build a JSON object for your custom block
custom_block="{\"full_text\":\"$jalali_date\",\"color\":\"#ffffff\"}"
# Insert your block before the rest
echo "${prefix}[$custom_block, ${line#\[}"
done