Adding lots of cool stuff to dotfiles

This commit is contained in:
Antoine Phan
2024-02-29 01:00:26 -05:00
parent b5ad2b6c39
commit dd2ef8ddac
390 changed files with 35966 additions and 1 deletions

View File

@@ -0,0 +1,23 @@
#!/bin/bash
CMD=$(xset -q | grep Caps)
# echo $CMD
CAPS=$(echo $CMD | awk '{print $4}')
NUMS=$(echo $CMD | awk '{print $8}')
if [ $CAPS = "on" ]
then
CAPS_ICON="⏏️"
else
CAPS_ICON="⬆️"
fi
if [ $NUMS = "on" ]
then
NUMS_ICON="♾️"
else
NUMS_ICON="🔢"
fi
echo "$CAPS_ICON""$NUMS_ICON"

View File

@@ -0,0 +1,51 @@
#!/bin/bash
ACPI_RES=$(acpi -b)
ACPI_CODE=$?
if [ $ACPI_CODE -eq 0 ]
then
# Get essential information. Due to som bug with some versions of acpi it is
# worth filtering the ACPI result from all lines containing "unavailable".
BAT_LEVEL_ALL=$(echo "$ACPI_RES" | grep -v "unavailable" | grep -E -o "[0-9][0-9]?[0-9]?%")
BAT_LEVEL=$(echo "$BAT_LEVEL_ALL" | awk -F"%" 'BEGIN{tot=0;i=0} {i++; tot+=$1} END{printf("%d%\n", tot/i)}')
TIME_LEFT=$(echo "$ACPI_RES" | grep -v "unavailable" | grep -E -o "[0-9]{2}:[0-9]{2}:[0-9]{2}")
IS_CHARGING=$(echo "$ACPI_RES" | grep -v "unavailable" | awk '{ printf("%s\n", substr($3, 0, length($3)-1) ) }')
# If there is no 'time left' information (when almost fully charged) we
# provide information ourselvs.
if [ -z "$TIME_LEFT" ]
then
TIME_LEFT="00:00:00"
fi
# Print full text. The charging data.
TIME_LEFT=$(echo $TIME_LEFT | awk '{ printf("%s\n", substr($1, 0, 5)) }')
#echo "🔋$BAT_LEVEL ⏳$TIME_LEFT "
# Print the short text.
#echo "BAT: $BAT_LEVEL"
# Change the font color, depending on the situation.
if [ "$IS_CHARGING" = "Charging" ]
then
echo "$BAT_LEVEL"
echo ""
echo "#eac553"
else
if [ "${BAT_LEVEL%?}" -le 32 ]
then
echo "🪫 $BAT_LEVEL$TIME_LEFT"
echo
echo "#f0465c"
elif [ "${BAT_LEVEL%?}" -le 64 ]
then
echo "🔋 $BAT_LEVEL$TIME_LEFT"
echo
echo "#f09e6e"
else
echo "🔋 $BAT_LEVEL"
echo
echo "#bbff66"
fi
fi
fi

View File

@@ -0,0 +1,29 @@
#!/bin/bash
current=$(brightnessctl g)
max=$(brightnessctl m)
percentage=$(printf "%3s" $((100 * current / max)))
if [[ $percentage -eq 100 ]]
then
ICON="🎑"
elif (( $percentage >= 75 ))
then
ICON="🌕"
elif (( $percentage >= 50 ))
then
ICON="🌖"
elif (( $percentage >= 25 ))
then
ICON="🌗"
elif (( $percentage >= 10 ))
then
ICON="🌘"
elif (( $percentage >= 0 ))
then
ICON="🌑"
else
ICON="🌚"
fi
echo "$ICON $percentage% "

40
.config/i3blocks/config Normal file
View File

@@ -0,0 +1,40 @@
[TIME_DATE]
command=date +"📆 %A %B %d ⏰ %I:%M %p %Z"
interval=1
color=#4ce09b
# [TIME_DATE_PORTUGAL]
# command=TZ=":Europe/Lisbon" date +"🇵🇹 %I:%M %p %Z"
# interval=1
# color=#4de83caa
[BATTERY]
command=~/.config/i3blocks/battery/battery.sh
interval=12
# [BATTERY-CAP]
# command=upower -i `upower -e | grep 'BAT'` | grep "energy-full-design:" | awk '{printf("%.2f Wh\n", $2)}'
# interval=once
# color=#ff9987
[MEM]
command=free -h | awk '/Mem:/ { printf(" 🐏 %5s/%s\n", $3, $2) }'
interval=12
color=#73e0e6
[SOUND]
command=$HOME/.config/i3blocks/sound/sound.sh
interval=2
signal=1
color=#81a4fc
[BRIGHTNESS]
command=$HOME/.config/i3blocks/brightness.sh
interval=once
signal=2
color=#f8ffe8
[CAPSNUM-LOCK]
command=$HOME/.config/i3blocks/CapsNumLock/capsnumlock.sh
interval=once
signal=10

View File

@@ -0,0 +1,4 @@
#!/bin/sh
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))}')
echo "$CPU_USAGE $TEMP" | awk '{ printf(" CPU:%6s% @ %s \n"), $1, $2 }'

View File

@@ -0,0 +1,33 @@
#!/bin/sh
VOLUME_MUTE="🔇"
VOLUME_LOW="🔈"
VOLUME_MID="🔉"
VOLUME_HIGH="🔊"
MICROPHONE="🎤"
SOUND_LEVEL=$(wpctl get-volume @DEFAULT_SINK@ | awk '{printf("%3s\n", $2 * 100)}')
MUTED=$(wpctl get-volume @DEFAULT_SINK@ | awk '{print $3 == "[MUTED]"}')
MIC=$(wpctl get-volume @DEFAULT_SOURCE@ | awk '{printf("%3s\n", $2 * 100)}')
SINK=$(wpctl inspect @DEFAULT_SINK@ | grep node.description | awk '{print $4}' | tr -d '"')
SOURCE=$(wpctl inspect @DEFAULT_SOURCE@ | grep node.description | awk '{print $4}' | tr -d '"')
ICON=$VOLUME_MUTE
if [ "$MUTED" = "1" ]
then
ICON="$VOLUME_MUTE"
else
if [ $SOUND_LEVEL -lt 34 ]
then
ICON="$VOLUME_LOW"
elif [ $SOUND_LEVEL -lt 67 ]
then
ICON="$VOLUME_MID"
else
ICON="$VOLUME_HIGH"
fi
fi
echo "$ICON $SOUND_LEVEL% $MICROPHONE $MIC% 🎧 $SINK 🎙️ $SOURCE"

View File

@@ -0,0 +1,6 @@
#!/bin/sh
for i in $(seq 1 5)
do
sleep 0.2
pkill -RTMIN+1 i3blocks
done

View File

@@ -0,0 +1,13 @@
#!/bin/bash
TEMP_C=$(inxi -wx --weather-unit m | grep -o "temperature.*" | awk '{ print $2 }')
RH=$(inxi -wx --weather-unit m | grep humidity | awk '{ print $8}'| tr -d '%')
TDEW=$(awk "BEGIN {
print $TEMP_C - ((100 - $RH)/5)
}")
HUMIDEX=$(awk "BEGIN {
print $TEMP_C * $RH
}")
echo "$TEMP_C C $RH % $TDEW $HUMIDEX"