diff --git a/.config/i3/config b/.config/i3/config index 8db5356..7d620f1 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -14,7 +14,8 @@ set $mod Mod4 # Font for window titles. Will also be used by the bar unless a different font # is used in the bar {} block below. #font pango:monospace 10 -font pango:Noto Sans 10 +font pango:UbuntuMono Nerd Font 11.5 +#font pango:Noto Sans 10 #font pango:Ubuntu 10.5 # This font is widely installed, provides lots of unicode glyphs, right-to-left @@ -179,8 +180,8 @@ bindsym $mod+a focus parent #bindsym $mod+d focus child # i3-gaps config -#gaps inner 6 -#gaps outer 2 +#gaps inner 2 +#gaps outer 1 # Define names for default workspaces for which we configure key bindings later on. # We use variables to avoid repeating the names in multiple places. @@ -289,7 +290,8 @@ bindsym $mod+r mode "resize" # finds out, if available) bar { position top - i3bar_command $HOME/.config/polybar/launch.sh + status_command $HOME/.config/i3/scripts/status_bar.sh + #i3bar_command $HOME/.config/polybar/launch.sh #status_command i3status #status_command i3blocks #tray_output DisplayPort-0 diff --git a/.config/i3/scripts/checkUpdates.sh b/.config/i3/scripts/checkUpdates.sh new file mode 100755 index 0000000..59ae3f2 --- /dev/null +++ b/.config/i3/scripts/checkUpdates.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Check updates on Arch Linux +# Note: Create cron on /etc/cron.d/checkupdates with the following lines: +# 0 * * * * root /usr/bin/pacman -Sy +# 30 * * * * root /usr/bin/pacman -Sy +if [ -f /usr/bin/pacman ] ; then + num_packages=$(pacman -Qu | wc -l) + echo " ${num_packages} " + +# Check updates on Ubuntu/Debian/Devuan +# Note: Create cron on /etc/cron.d/checkupdates with the following lines: +# 0 * * * * root /usr/bin/aptitude update +# 30 * * * * root /usr/bin/aptitude update +elif [ -f /usr/bin/aptitude ] ; then + num_packages=$(aptitude search "~U" | wc -l) + echo " ${num_packages} " + +# Disable for other distros +else + echo " 0 " +fi diff --git a/.config/i3/scripts/cpu_info.sh b/.config/i3/scripts/cpu_info.sh new file mode 100755 index 0000000..d68616a --- /dev/null +++ b/.config/i3/scripts/cpu_info.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +check_sensor=$(sensors | grep "Tdie:" 2> /dev/null) +if [ -z "${check_sensor}" ] ; then + check_sensor=$(sensors | grep "Tctl:" 2> /dev/null) + if [ -z "${check_sensor}" ] ; then + CPU_USAGE=$(~/.config/dwm/scripts/cpu_load.sh -p) + echo "$CPU_USAGE" | awk '{ printf("%6s \n"), $1, $2 }' + else + TEMP=$(sensors | grep 'Package id 0:\|Tctl' | grep ':[ ]*+[0-9]*.[0-9]*°C' -o | grep '+[0-9]*.[0-9]*°C' -o) + #CPU_USAGE=$(mpstat 1 1 | awk '/Average:/ {printf("%s\n", $(NF-9))}') + CPU_USAGE=$(~/.config/dwm/scripts/cpu_load.sh -p) + echo "$CPU_USAGE $TEMP" | awk '{ printf("%6s @ %s \n"), $1, $2 }' + fi +else + TEMP=$(sensors | grep 'Package id 0:\|Tdie' | grep ':[ ]*+[0-9]*.[0-9]*°C' -o | grep '+[0-9]*.[0-9]*°C' -o) + #CPU_USAGE=$(mpstat 1 1 | awk '/Average:/ {printf("%s\n", $(NF-9))}') + CPU_USAGE=$(~/.config/dwm/scripts/cpu_load.sh -p) + echo "$CPU_USAGE $TEMP" | awk '{ printf("%6s @ %s \n"), $1, $2 }' +fi diff --git a/.config/i3/scripts/cpu_load.sh b/.config/i3/scripts/cpu_load.sh new file mode 100755 index 0000000..57fc7e5 --- /dev/null +++ b/.config/i3/scripts/cpu_load.sh @@ -0,0 +1,83 @@ +#!/bin/bash + +# Script to show cpu +# Created by q3aql (q3aql@protonmail.ch) +# Licensed by GPL v.2 +# Date: 10-01-2020 +# -------------------------------------- +VERSION="1.0" + + +# Variables +cpuPercentage=$(top -b -n1 | grep \%Cpu | awk '{print 100-$8}') +showCpuPercentage=$(echo ${cpuPercentage}) +showCpuPercentageInteger=$(echo ${showCpuPercentage} | cut -d "." -f 1) + +# Show percentage bar +if [ ${showCpuPercentageInteger} -ge 0 ] ; then + showCpuPercentageBar="=" +fi +if [ ${showCpuPercentageInteger} -ge 3 ] ; then + showCpuPercentageBar="==" +fi +if [ ${showCpuPercentageInteger} -ge 12 ] ; then + showCpuPercentageBar="===" +fi +if [ ${showCpuPercentageInteger} -ge 18 ] ; then + showCpuPercentageBar="====" +fi +if [ ${showCpuPercentageInteger} -ge 25 ] ; then + showCpuPercentageBar="=====" +fi +if [ ${showCpuPercentageInteger} -ge 35 ] ; then + showCpuPercentageBar="======" +fi +if [ ${showCpuPercentageInteger} -ge 40 ] ; then + showCpuPercentageBar="=======" +fi +if [ ${showCpuPercentageInteger} -ge 45 ] ; then + showCpuPercentageBar="========" +fi +if [ ${showCpuPercentageInteger} -ge 50 ] ; then + showCpuPercentageBar="==========" +fi +if [ ${showCpuPercentageInteger} -ge 62 ] ; then + showCpuPercentageBar="=============" +fi +if [ ${showCpuPercentageInteger} -ge 75 ] ; then + showCpuPercentageBar="===============" +fi +if [ ${showCpuPercentageInteger} -ge 85 ] ; then + showCpuPercentageBar="=================" +fi +if [ ${showCpuPercentageInteger} -ge 90 ] ; then + showCpuPercentageBar="==================" +fi +if [ ${showCpuPercentageInteger} -ge 95 ] ; then + showCpuPercentageBar="===================" +fi +if [ ${showCpuPercentageInteger} -ge 100 ] ; then + showCpuPercentageBar="====================" +fi + +# Show results +if [ "$1" == "-p" ]; then + echo ${showCpuPercentage}% +elif [ "$1" == "-b" ]; then + echo ${showCpuPercentageBar} +else + echo "" + echo " cpuinfo v$VERSION" + echo " ------------" + echo "" + echo " CpuPercentage Use:" + echo " ${showCpuPercentageBar} ${showCpuPercentage}%" + echo "" + echo " Available commands:" + echo "" + echo " cpuinfo.sh -p | Show CpuPercentage" + echo " cpuinfo.sh -b | Show CpuPercentage Bar" + echo "" + echo " Note: Conky require 'maximum_width = 240'" + echo "" +fi diff --git a/.config/i3/scripts/current_date.sh b/.config/i3/scripts/current_date.sh new file mode 100755 index 0000000..224de78 --- /dev/null +++ b/.config/i3/scripts/current_date.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +current_date=$(date "+%d/%m/%Y %H:%M") +echo " ${current_date} " diff --git a/.config/i3/scripts/disk_info.sh b/.config/i3/scripts/disk_info.sh new file mode 100755 index 0000000..da3f2b2 --- /dev/null +++ b/.config/i3/scripts/disk_info.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +df -h / | awk '/\//{ printf(" %4s / %s \n", $4, $2) }' diff --git a/.config/i3/scripts/get_volume.sh b/.config/i3/scripts/get_volume.sh new file mode 100755 index 0000000..a501178 --- /dev/null +++ b/.config/i3/scripts/get_volume.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +get_volume=$(amixer | grep "%" | head -1 | cut -d "%" -f 1 | cut -d "[" -f 2) +echo " ${get_volume}% " diff --git a/.config/i3/scripts/kernel_version.sh b/.config/i3/scripts/kernel_version.sh new file mode 100755 index 0000000..8483f29 --- /dev/null +++ b/.config/i3/scripts/kernel_version.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Parameters +longNumber=2 +kernelCommand="uname -r" +archCommand=$(uname -m) + +# Kernel version +kernelVersion="" +count=1 + +# Extract numbers of kernel version +kernelVersionTemp=$(uname -r | cut -d "." -f ${count}) + kernelVersionTempDot="${kernelVersionTemp}" + kernelVersion="${kernelVersion}${kernelVersionTempDot}" + count=$(expr ${count} + 1) + +while [ ${count} -le ${longNumber} ] ; do + kernelVersionTemp=$(uname -r | cut -d "." -f ${count}) + kernelVersionTempDot=".${kernelVersionTemp}" + kernelVersion="${kernelVersion}${kernelVersionTempDot}" + count=$(expr ${count} + 1) +done + +kernelVersionTemp=$(uname -r | cut -d "." -f ${count} | cut -d "-" -f 1) +kernelVersionTempDot=".${kernelVersionTemp}" +kernelVersion=${kernelVersion}${kernelVersionTempDot} + +# Apply arch +#kernelVersion=${kernelVersion}-${archCommand} +kernelVersion=${kernelVersion} +#echo "Kernel: Linux ${kernelVersion} " +echo " ${kernelVersion} " + diff --git a/.config/i3/scripts/kernel_version_num.sh b/.config/i3/scripts/kernel_version_num.sh new file mode 100755 index 0000000..8483f29 --- /dev/null +++ b/.config/i3/scripts/kernel_version_num.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Parameters +longNumber=2 +kernelCommand="uname -r" +archCommand=$(uname -m) + +# Kernel version +kernelVersion="" +count=1 + +# Extract numbers of kernel version +kernelVersionTemp=$(uname -r | cut -d "." -f ${count}) + kernelVersionTempDot="${kernelVersionTemp}" + kernelVersion="${kernelVersion}${kernelVersionTempDot}" + count=$(expr ${count} + 1) + +while [ ${count} -le ${longNumber} ] ; do + kernelVersionTemp=$(uname -r | cut -d "." -f ${count}) + kernelVersionTempDot=".${kernelVersionTemp}" + kernelVersion="${kernelVersion}${kernelVersionTempDot}" + count=$(expr ${count} + 1) +done + +kernelVersionTemp=$(uname -r | cut -d "." -f ${count} | cut -d "-" -f 1) +kernelVersionTempDot=".${kernelVersionTemp}" +kernelVersion=${kernelVersion}${kernelVersionTempDot} + +# Apply arch +#kernelVersion=${kernelVersion}-${archCommand} +kernelVersion=${kernelVersion} +#echo "Kernel: Linux ${kernelVersion} " +echo " ${kernelVersion} " + diff --git a/.config/i3/scripts/mem_info.sh b/.config/i3/scripts/mem_info.sh new file mode 100755 index 0000000..ac8c2ad --- /dev/null +++ b/.config/i3/scripts/mem_info.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +# Configuration variable +python_bin="/usr/bin/python3" +memfile="/proc/meminfo" +size="G" # Change to M for MiB + +# Variables +memTotal=$(cat ${memfile} | grep -i "memtotal:" | head -1 | tr -s " " | cut -d " " -f 2) +memActive=$(cat ${memfile} | grep -i "memavailable:" | head -1 | tr -s " " | cut -d " " -f 2) +memActive=$(expr ${memTotal} - ${memActive}) + +# Variables to calculate +memTotalM=$(expr ${memTotal} / 1024 ) +memActiveM=$(expr ${memActive} / 1024) +if [ -f ${python_bin} ] ; then + memPercentage=$(echo "n=${memActive}/${memTotal}*100 ; print(n)" | ${python_bin}) + memTotalG=$(echo "n=${memTotalM}/1024 ; print(n)" | ${python_bin} | tr -s " " | cut -c1-4) + memActiveG=$(echo "n=${memActiveM}/1024 ; print(n)" | ${python_bin} | tr -s " " | cut -c1-4) +elif [ -f /usr/bin/calc ] ; then + memPercentage=$(calc ${memActive} / ${memTotal} \* 100) + memTotalG=$(calc ${memTotalM} / 1024 | tr -s " " | cut -c1-5) + memActiveG=$(calc ${memActiveM} / 1024 | tr -s " " | cut -c1-5) +else + memPercentage=$(expr ${memActive} / ${memTotal} \* 100) + memTotalG=$(expr ${memTotalM} / 1024 | tr -s " " | cut -c1-5) + memActiveG=$(expr ${memActiveM} / 1024 | tr -s " " | cut -c1-5) +fi + +# Variables to show +showMemPercentage=$(echo ${memPercentage} | cut -d "~" -f 2 | cut -d "." -f 1) +if [ "${size}" == "G" ] ; then + showMemTotal="${memTotalG}Gi" + showMemActive="${memActiveG}Gi" +elif [ "${size}" == "M" ] ; then + showMemTotal="${memTotalM}Mi" + showMemActive="${memActiveM}Mi" +else + showMemTotal="${memTotalG}Gi" + showMemActive="${memActiveG}Gi" +fi + +echo -n " " +memshowactive=$(echo ${showMemActive}) +memshowtotal=$(echo ${showMemTotal}) +echo -n ${memshowactive}/${memshowtotal} +echo " " diff --git a/.config/i3/scripts/mem_info_new.sh b/.config/i3/scripts/mem_info_new.sh new file mode 100755 index 0000000..8ed29c1 --- /dev/null +++ b/.config/i3/scripts/mem_info_new.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# Configuration variables +memfile="/proc/meminfo" +size="G" # Change to M for MiB + +# Variables +memTotal=$(cat ${memfile} | grep -i "memtotal:" | head -1 | tr -s " " | cut -d " " -f 2) +memActive=$(cat ${memfile} | grep -i "memavailable:" | head -1 | tr -s " " | cut -d " " -f 2) +memActive=$(expr ${memTotal} - ${memActive}) + +# Variables to calculate +memTotalM=$(expr ${memTotal} / 1024 ) +memActiveM=$(expr ${memActive} / 1024) +if [ -f /usr/bin/calc ] ; then + memPercentage=$(calc ${memActive} / ${memTotal} \* 100) + memTotalG=$(calc ${memTotalM} / 1024 | tr -s " " | cut -c1-5) + memActiveG=$(calc ${memActiveM} / 1024 | tr -s " " | cut -c1-5) +else + memPercentage=$(expr ${memActive} / ${memTotal} \* 100) + memTotalG=$(expr ${memTotalM} / 1024 | tr -s " " | cut -c1-5) + memActiveG=$(expr ${memActiveM} / 1024 | tr -s " " | cut -c1-5) +fi + +# Variables to show +showMemPercentage=$(echo ${memPercentage} | cut -d "~" -f 2 | cut -d "." -f 1) +if [ "${size}" == "G" ] ; then + showMemTotal="${memTotalG}Gi" + showMemActive="${memActiveG}Gi" +elif [ "${size}" == "M" ] ; then + showMemTotal="${memTotalM}Mi" + showMemActive="${memActiveM}Mi" +else + showMemTotal="${memTotalG}Gi" + showMemActive="${memActiveG}Gi" +fi + +echo -n " " +memshowactive=$(echo ${showMemActive}) +memshowtotal=$(echo ${showMemTotal}) +echo -n ${memshowactive}/${memshowtotal} +echo " " diff --git a/.config/i3/scripts/mem_info_old.sh b/.config/i3/scripts/mem_info_old.sh new file mode 100755 index 0000000..6c8eeec --- /dev/null +++ b/.config/i3/scripts/mem_info_old.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +mem_info=$(free -h | awk '/Mem:/ { printf(" %5s/%s \n", $3, $2) }') +echo -n " " +echo -n ${mem_info} +echo " " diff --git a/.config/i3/scripts/status_bar.sh b/.config/i3/scripts/status_bar.sh new file mode 100755 index 0000000..1ea0dec --- /dev/null +++ b/.config/i3/scripts/status_bar.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +status_bar=0 + +while [ ${status_bar} -eq 0 ] ; do + updates=$(~/.config/i3/scripts/checkUpdates.sh) + kernel=$(~/.config/i3/scripts/kernel_version.sh) + cpuinfo=$(~/.config/i3/scripts/cpu_info.sh) + meminfo=$(~/.config/i3/scripts/mem_info.sh) + volume=$(~/.config/i3/scripts/get_volume.sh) + date=$(~/.config/i3/scripts/current_date.sh) + echo "${updates} ${kernel} ${cpuinfo} ${meminfo} ${volume} ${date}" + sleep 2 +done diff --git a/examples/i3.png b/examples/i3.png index f4ce018..341810c 100644 Binary files a/examples/i3.png and b/examples/i3.png differ