From 1f2824b912b22a687fb0f1c56f82198128bef1ca Mon Sep 17 00:00:00 2001 From: Mosder Date: Wed, 10 Jun 2026 02:24:31 +0200 Subject: added and updated a lot of configs + refactored it to be more accessible --- .../.config/hypr/scripts/battery-notifier.sh | 36 ++++++++++++++++++++++ .../.config/hypr/scripts/current-brightness.sh | 4 +++ .../.config/hypr/scripts/randomize-wallpaper.sh | 11 +++++++ 3 files changed, 51 insertions(+) create mode 100755 laptop/home/mosder/.config/hypr/scripts/battery-notifier.sh create mode 100755 laptop/home/mosder/.config/hypr/scripts/current-brightness.sh create mode 100755 laptop/home/mosder/.config/hypr/scripts/randomize-wallpaper.sh (limited to 'laptop/home/mosder/.config/hypr/scripts') diff --git a/laptop/home/mosder/.config/hypr/scripts/battery-notifier.sh b/laptop/home/mosder/.config/hypr/scripts/battery-notifier.sh new file mode 100755 index 0000000..d586879 --- /dev/null +++ b/laptop/home/mosder/.config/hypr/scripts/battery-notifier.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +while true; do + # get battery status + acpi_info=$(acpi) + stat=$(echo $acpi_info | awk -F" " '{print $3}') + stat=${stat::-1} + perc=$(echo $acpi_info | awk -F" " '{print $4}') + perc=${perc::-2} + + # check if battery is discharging + if [[ $stat == Discharging ]]; then + # send notification if low power + if [[ $perc -le 15 ]]; then + notify-send -a Battery BATTERY\ CRITICAL\ -h int:value:$perc -u critical + elif [[ $perc -le 30 ]]; then + notify-send -a Battery Battery\ low\ -h int:value:$perc + fi + fi + + # calculate time until next check using interpolating polynomial + # of points (battery %, time [s] until next check): + # (100, 600) + # (50, 120) + # (30, 60) + # (15, 30) + # (0, 0) + x1=$(echo "scale=10; 188/85*$perc" | bc) + x2=$(echo "scale=10; -603/29750*$perc*$perc" | bc) + x3=$(echo "scale=10; 113/297500*$perc*$perc*$perc" | bc) + x4=$(echo "scale=10; 3/1487500*$perc*$perc*$perc*$perc" | bc) + sleep_time=$(echo $x1+$x2+$x3+$x4 | bc | awk -F"." '{print $1}') + + # sleep for calculated time + sleep $sleep_time +done diff --git a/laptop/home/mosder/.config/hypr/scripts/current-brightness.sh b/laptop/home/mosder/.config/hypr/scripts/current-brightness.sh new file mode 100755 index 0000000..4856e59 --- /dev/null +++ b/laptop/home/mosder/.config/hypr/scripts/current-brightness.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +s=$(brightnessctl | grep % | awk -F" " '{print $4}') +echo ${s:1:-2} diff --git a/laptop/home/mosder/.config/hypr/scripts/randomize-wallpaper.sh b/laptop/home/mosder/.config/hypr/scripts/randomize-wallpaper.sh new file mode 100755 index 0000000..116763b --- /dev/null +++ b/laptop/home/mosder/.config/hypr/scripts/randomize-wallpaper.sh @@ -0,0 +1,11 @@ +#!/usr/bin/bash + +WALLPAPER_DIR="$HOME/wallpapers" + +# Get a random wallpaper +WALLPAPER=$(find $WALLPAPER_DIR -type f | shuf -n 1) + +# Create a symlink to the new random wallpaper +SYMLINK=$WALLPAPER_DIR/.current +rm $SYMLINK +ln -s $WALLPAPER $SYMLINK -- cgit v1.2.3