Other I can't get i3-blocks modules to work

I would like to get started with i3, but I have had problems with i3 blocks never working as I wanted. Here is what I want for my bar

-Cpu temp
-CPU usage
-memory usage

What do I need for configs and packages and help is greatly appreciated.
 
Hi,

Given information is light here.
You said what you want but not what you've done.
It won't be easy to help you in that situation.
In your case you should at least post your ~/.config/i3/config and ~/.config/i3blocks/config (or whatever name you gave them)

First did you read the given example by the readme on GitHub page ?
Then did you follow instructions listed in the "getting start" section ?
Also do not hesitate to the launch i3blocks in debugging mode, it helps a lot to find what's wrong.

Once you've done all that you should be able to at least get one block to work, then slowly build others step by step, depending on how you feel comfortable with the configuration files it can take time.
 
Hi,

Given information is light here.
You said what you want but not what you've done.
It won't be easy to help you in that situation.
In your case you should at least post your ~/.config/i3/config and ~/.config/i3blocks/config (or whatever name you gave them)

First did you read the given example by the readme on GitHub page ?
Then did you follow instructions listed in the "getting start" section ?
Also do not hesitate to the launch i3blocks in debugging mode, it helps a lot to find what's wrong.

Once you've done all that you should be able to at least get one block to work, then slowly build others step by step, depending on how you feel comfortable with the configuration files it can take time.
Thank you very much for the help, There are plenty of resources on Linux, I do apologize for the lack of data I provided, I however do not know for freebsd,
 
It doesn't change anything, if you can configure it and make it run as you wish on Linux, then you can do it on FreeBSD, configuration files are the same ;)
That's not where Linux and FreeBSD differs.

EDIT:
typo.
 
CPU_temp:

Bash:
#!/bin/sh

color0="#00ccff"
color1="#00e600"
color2="#ffff00"
color3="#ff9900"
color4="#ff0000"

temp_info="$(sysctl -n dev.cpu.0.temperature | cut -c 1-2)"
temp_print="$(sysctl -n dev.cpu.0.temperature | cut -c 1-2) °C"

if [ "$temp_info" -ge 01 ] && [ "$temp_info" -le 50 ]; then
    echo "$temp_print"
    echo "$temp_print"
    echo "$color0"
elif [ "$temp_info" -gt 50 ] && [ "$temp_info" -le 60 ]; then
    echo "$temp_print"
    echo "$temp_print"
    echo "$color1"
elif [ "$temp_info" -gt 60 ] && [ "$temp_info" -le 70 ]; then
    echo "$temp_print"
    echo "$temp_print"
    echo "$color2"
elif [ "$temp_info" -gt 70 ] && [ "$temp_info" -le 80 ]; then
    echo "$temp_print"
    echo "$temp_print"
    echo "$color3"
elif [ "$temp_info" -gt 80 ] && [ "$temp_info" -le 95 ]; then
    echo "$temp_print"
    echo "$temp_print"
    echo "$color4"
fi

CPU_load:

Bash:
#!/bin/sh

# Color
color="#6666ff"


URGENT_VALUE=90

LOAD=$(sysctl -n vm.loadavg | awk '{print $(NF-1)}' | cut -d ' ' -f 3,6)
if [ "${LOAD}" != "" ]; then
   LOAD_PERC=$(echo "scale=0; ${LOAD} * 100" | bc -l)
   LOAD_PERC=${LOAD_PERC%5.*}

   echo "${LOAD}"
   echo "${LOAD}"
   echo "$color"

   if [ "${LOAD_PERC}" -ge "${URGENT_VALUE}" ]; then
      exit 33
   fi
fi

Memory:
Bash:
#!/bin/sh

# Display used, free and total memory with the help of freecolor utility

total_mem="$(freecolor -m -o | head -n 2 | tail -n 1 | cut -c14-18)"
used_mem="$(freecolor -m -o | head -n 2 | tail -n 1 | cut -c24-29)"

if [ "${used_mem}" -lt "${total_mem}" ]; then
   echo "${used_mem}/${total_mem} MB"
   echo " "
fi
eg.

i3blocks.png
 
If you want to use Fahrenheit instead

Code:
#!/bin/sh

color0="#00ccff"
color1="#00e600"
color2="#ffff00"
color3="#ff9900"
color4="#ff0000"

temp_info="$(sysctl -n dev.cpu.0.temperature | cut -c 1-2)"
temp_print="$(echo $temp_info "*" "1.8" "+" "32" | bc ) °F"
#temp_print="$(sysctl -n dev.cpu.0.temperature | cut -c 1-2) °C"

if [ "$temp_info" -ge 01 ] && [ "$temp_info" -le 50 ]; then
    echo "$temp_print"
    echo "$temp_print"
    echo "color0"
elif [ "$temp_info" -gt 50 ] && [ "$temp_info" -le 60 ]; then
    echo "$temp_print"
    echo "$temp_print"
    echo "$color1"
elif [ "$temp_info" -gt 60 ] && [ "$temp_info" -le 70 ]; then
    echo "$temp_print"
    echo "$temp_print"
    echo "$color2"
elif [ "$temp_info" -gt 70 ] && [ "$temp_info" -le 80 ]; then
    echo "$temp_print"
    echo "$temp_print"
    echo "$color3"
elif [ "$temp_info" -gt 80 ] && [ "$temp_info" -le 95 ]; then
    echo "$temp_print"
    echo "$temp_print"
    echo "$color4"
fi
 
What do I need for configs and packages

Regarding this sentence I suppose OP has more problems with i3blocks in general than with a specific block.
The packages names are the same (i3 , i3blocks) I don't think that's where OP struggles.
But as we don't know what's in his config files, it's difficult to guess how really is the situation.
 
CPU_temp:

Bash:
#!/bin/sh

color0="#00ccff"
color1="#00e600"
color2="#ffff00"
color3="#ff9900"
color4="#ff0000"

temp_info="$(sysctl -n dev.cpu.0.temperature | cut -c 1-2)"
temp_print="$(sysctl -n dev.cpu.0.temperature | cut -c 1-2) °C"

if [ "$temp_info" -ge 01 ] && [ "$temp_info" -le 50 ]; then
    echo "$temp_print"
    echo "$temp_print"
    echo "$color0"
elif [ "$temp_info" -gt 50 ] && [ "$temp_info" -le 60 ]; then
    echo "$temp_print"
    echo "$temp_print"
    echo "$color1"
elif [ "$temp_info" -gt 60 ] && [ "$temp_info" -le 70 ]; then
    echo "$temp_print"
    echo "$temp_print"
    echo "$color2"
elif [ "$temp_info" -gt 70 ] && [ "$temp_info" -le 80 ]; then
    echo "$temp_print"
    echo "$temp_print"
    echo "$color3"
elif [ "$temp_info" -gt 80 ] && [ "$temp_info" -le 95 ]; then
    echo "$temp_print"
    echo "$temp_print"
    echo "$color4"
fi

CPU_load:

Bash:
#!/bin/sh

# Color
color="#6666ff"


URGENT_VALUE=90

LOAD=$(sysctl -n vm.loadavg | awk '{print $(NF-1)}' | cut -d ' ' -f 3,6)
if [ "${LOAD}" != "" ]; then
   LOAD_PERC=$(echo "scale=0; ${LOAD} * 100" | bc -l)
   LOAD_PERC=${LOAD_PERC%5.*}

   echo "${LOAD}"
   echo "${LOAD}"
   echo "$color"

   if [ "${LOAD_PERC}" -ge "${URGENT_VALUE}" ]; then
      exit 33
   fi
fi

Memory:
Bash:
#!/bin/sh

# Display used, free and total memory with the help of freecolor utility

total_mem="$(freecolor -m -o | head -n 2 | tail -n 1 | cut -c14-18)"
used_mem="$(freecolor -m -o | head -n 2 | tail -n 1 | cut -c24-29)"

if [ "${used_mem}" -lt "${total_mem}" ]; then
   echo "${used_mem}/${total_mem} MB"
   echo " "
fi
eg.

View attachment 15348
Do I place them in i3 blocks config?
 
Do I place them in i3 blocks config?
No, you make a separate folder in .config/i3 and put them there. Each block has his own file which needs to have executable rights since they are basically shell scripts. Also make sure that you include the path to blocks in Your i3blocks config.
e.g.:
i3blocks.png


i3blocks2.png
 
Back
Top