Dotfiles config update (2023-01-03)

This commit is contained in:
q3aql 2023-01-03 03:33:36 +01:00
parent d9f973b78d
commit 02e779f675
14 changed files with 319 additions and 4 deletions

View File

@ -14,7 +14,8 @@ set $mod Mod4
# Font for window titles. Will also be used by the bar unless a different font # Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below. # is used in the bar {} block below.
#font pango:monospace 10 #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 #font pango:Ubuntu 10.5
# This font is widely installed, provides lots of unicode glyphs, right-to-left # 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 #bindsym $mod+d focus child
# i3-gaps config # i3-gaps config
#gaps inner 6 #gaps inner 2
#gaps outer 2 #gaps outer 1
# Define names for default workspaces for which we configure key bindings later on. # Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places. # We use variables to avoid repeating the names in multiple places.
@ -289,7 +290,8 @@ bindsym $mod+r mode "resize"
# finds out, if available) # finds out, if available)
bar { bar {
position top 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 i3status
#status_command i3blocks #status_command i3blocks
#tray_output DisplayPort-0 #tray_output DisplayPort-0

View File

@ -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

20
.config/i3/scripts/cpu_info.sh Executable file
View File

@ -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

83
.config/i3/scripts/cpu_load.sh Executable file
View File

@ -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

View File

@ -0,0 +1,4 @@
#!/bin/bash
current_date=$(date "+%d/%m/%Y %H:%M")
echo "${current_date} "

View File

@ -0,0 +1,3 @@
#!/bin/bash
df -h / | awk '/\//{ printf(" %4s / %s \n", $4, $2) }'

View File

@ -0,0 +1,4 @@
#!/bin/bash
get_volume=$(amixer | grep "%" | head -1 | cut -d "%" -f 1 | cut -d "[" -f 2)
echo "${get_volume}% "

View File

@ -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} "

View File

@ -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} "

47
.config/i3/scripts/mem_info.sh Executable file
View File

@ -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 " "

View File

@ -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 " "

View File

@ -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 " "

View File

@ -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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 505 KiB

After

Width:  |  Height:  |  Size: 626 KiB