forked from Keyitdev/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update: Changed scipts, updated readme.
- Loading branch information
Showing
11 changed files
with
208 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,35 @@ | ||
#!/bin/bash | ||
#!/bin/sh | ||
|
||
for pid in $(pidof -x battery); do | ||
if [ $pid != $$ ]; then | ||
kill -9 $pid | ||
if [ "$pid" != $$ ]; then | ||
kill -9 "$pid" | ||
fi | ||
done | ||
|
||
DIR_ICONS="/usr/local/bin/icons" | ||
dir_icons="/usr/local/bin/icons" | ||
|
||
# Notify when below this percentage | ||
WARNING_LEVEL=15 | ||
# notify when below this percentage | ||
warning_level=15 | ||
|
||
# How often to check battery status, in minutes | ||
CHECK_INTERVAL=1 | ||
# how often to check battery status, in minutes | ||
check_interval=1 | ||
|
||
while true; do | ||
battery_level=$(acpi -b \ | ||
| cut -d, -f2 | cut --characters=2,3,4 \ | ||
| sed 's/%//g') | ||
charging=$(acpi -b | grep -c "Charging") | ||
charging=$(acpi -b | grep -c "charging") | ||
|
||
# When battery is low, and not already charging | ||
if [ $battery_level -lt $WARNING_LEVEL ] && | ||
[ $charging -eq 0 ] | ||
# when battery is low, and not already charging | ||
if [ "$battery_level" -lt "$warning_level" ] && | ||
[ "$charging" -eq 0 ] | ||
then | ||
dunstify -a "Battery" \ | ||
"Low battery: ${battery_level}%" \ | ||
"Battery is running low" \ | ||
-r 100 \ | ||
-i $DIR_ICONS/battery.svg | ||
-i $dir_icons/battery.svg | ||
fi | ||
|
||
sleep ${CHECK_INTERVAL}m | ||
done | ||
sleep ${check_interval}m | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
#!/bin/bash | ||
#!/bin/sh | ||
|
||
DIR_ICONS="/usr/local/bin/icons" | ||
dir_icons="/usr/local/bin/icons" | ||
|
||
MAX_BRI=$(cat /sys/class/backlight/*/max_brightness) | ||
CUR_BRI=$(cat /sys/class/backlight/*/brightness) | ||
max_bri=$(cat /sys/class/backlight/*/max_brightness) | ||
cur_bri=$(cat /sys/class/backlight/*/brightness) | ||
|
||
# calculating current percentage | ||
((CUR_PER = CUR_BRI * 100 / MAX_BRI)) | ||
cur_per=$((cur_bri * 100 / max_bri)) | ||
|
||
if [ $CUR_PER -ge 50 ]; then | ||
if [ "$cur_per" -ge 50 ]; then | ||
dunstify -a "Brightness" \ | ||
"Brightness" \ | ||
"Current brightness is $CUR_PER%" \ | ||
"Current brightness is $cur_per%" \ | ||
-r 100 \ | ||
-i $DIR_ICONS/sun.svg | ||
-i "$dir_icons"/sun.svg | ||
else | ||
dunstify -a "Brightness" \ | ||
"Brightness" \ | ||
"Current brightness is $CUR_PER%" \ | ||
"Current brightness is $cur_per%" \ | ||
-r 100 \ | ||
-i $DIR_ICONS/moon.svg | ||
-i "$dir_icons"/moon.svg | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,44 @@ | ||
#!/bin/bash | ||
#!/bin/sh | ||
|
||
DIR="/usr/local/bin/icons" | ||
dir="/usr/local/bin/icons" | ||
|
||
CUR_VOL=$(pactl list sinks | grep '^[[:space:]]Volume:' | \ | ||
head -n $(( $SINK + 1 )) | tail -n 1 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,') | ||
MUTE=$(pactl list sinks | grep Mute | sed 's/.*Mute: //g' | sed 1q) | ||
cur_vol=$(pactl list sinks | grep '^[[:space:]]Volume:' | \ | ||
head -n $(( SINK + 1 )) | tail -n 1 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,') | ||
MUTE=$(pacmd list-sinks | awk '/muted/ { print $2 }' | head -1) | ||
affirmative="yes" | ||
negative="no" | ||
|
||
VOL_QUIET=33 | ||
VOL_LOUD=66 | ||
vol_quiet=33 | ||
vol_loud=66 | ||
|
||
if [[ $MUTE = $affirmative ]]; then | ||
if [ "$MUTE" = "$affirmative" ]; then | ||
dunstify -a "Mute" \ | ||
"Mute" \ | ||
"Muted" \ | ||
"Sink is now muted" \ | ||
-r 100 \ | ||
-i $DIR/volume-x.svg | ||
elif [[ $MUTE = $negative ]]; then | ||
if [ $CUR_VOL -le $VOL_QUIET ]; then | ||
-i "$dir"/volume-x.svg | ||
elif [ "$MUTE" = "$negative" ]; then | ||
if [ "$cur_vol" -le "$vol_quiet" ]; then | ||
dunstify -a "Mute" \ | ||
"Mute" \ | ||
"Unmuted" \ | ||
"Sink is now unmuted" \ | ||
-r 100 \ | ||
-i $DIR/volume.svg | ||
-i "$dir"/volume.svg | ||
fi | ||
if [ $CUR_VOL -gt $VOL_QUIET ] && [ $CUR_VOL -le $VOL_LOUD ]; then | ||
if [ "$cur_vol" -gt "$vol_quiet" ] && [ "$cur_vol" -le "$vol_loud" ]; then | ||
dunstify -a "Mute" \ | ||
"Mute" \ | ||
"Unmuted" \ | ||
"Sink is now unmuted" \ | ||
-r 100 \ | ||
-i $DIR/volume-1.svg | ||
-i "$dir"/volume-1.svg | ||
fi | ||
if [ $CUR_VOL -gt $VOL_LOUD ]; then | ||
if [ "$cur_vol" -gt "$vol_loud" ]; then | ||
dunstify -a "Mute" \ | ||
"Mute" \ | ||
"Unmuted" \ | ||
"Sink is now unmuted" \ | ||
-r 100 \ | ||
-i $DIR/volume-2.svg | ||
-i "$dir"/volume-2.svg | ||
fi | ||
|
||
fi | ||
echo $MUTE | ||
echo "$MUTE" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.