feat: remove deprecated scripts

BREAKING: remove bat_notify
-> notifications are sent through .local/bin/statusbar/sb-battery
BREAKING: remove AC_notify
BREAKING: remove backligt_notify
BREAKING: remove refbar
-> use dwmblocks
This commit is contained in:
David JULIEN 2021-02-13 20:32:03 +01:00
parent 306ff0eb81
commit df6918e262
6 changed files with 10 additions and 107 deletions

View File

@ -1,39 +0,0 @@
#!/usr/bin/env sh
######################################################################
# @author : swytch
# @file : AC_notify
# @license : MIT
# @created : Wednesday May 20, 2020 17:51:45 CEST
#
# @description : send a notification when AC status change
# refresh statusbar
######################################################################
new_state="$(cat /sys/class/power_supply/AC/online)"
prev_state="$new_state"
notify() { \
# $1 is $new_state
if [ "$1" = 1 ]; then
notify-send -u "normal" "AC plugged in - CHARGING"
else
notify-send -u "critical" "AC unplugged ! - DISCHARGING"
fi
}
update(){ \
new_state="$(cat /sys/class/power_supply/AC/online)"
if [ "$prev_state" != "$new_state" ]; then
notify "$new_state" && refbar
fi
prev_state="$new_state"
}
while :; do
update
# Sleep for 5s seconds before checking again
sleep 5 &
wait
done

View File

@ -6,11 +6,9 @@
## Scripts
- AC_notify : send a notification when the computer is plugged/unplugged
- arch_setup : my personnal machine setup script
- audio-notify : send a notification when audio level is changed
- backlight_notify : send a notification when backlight level is changed
- bat_notify : send a notification when battery runs low
- bibinput : add a **.bib** entry through `dmenu`
- bibshow : retrieve a **.bib** reference and copy to `xclip`
- bulk : execute batch commands through your favorite $EDITOR

View File

@ -1,19 +0,0 @@
#!/usr/bin/env sh
######################################################################
# @author : swytch
# @file : backlight_notify
# @license : MIT
# @created : Wednesday May 20, 2020 17:53:36 CEST
#
# @description : send a notification with xbacklight value
######################################################################
current=$(cat /sys/class/backlight/intel_backlight/brightness)
max=$(cat /sys/class/backlight/intel_backlight/max_brightness)
step=$(expr $max / 20)
level=$(expr $(expr $current / $step) \* 5)
dunstify -r 100001 -u "low" "Current xBacklight value :" "$level%"

View File

@ -1,32 +0,0 @@
#!/usr/bin/env sh
######################################################################
# @author : swytch
# @file : bat_notify
# @license : MIT
# @created : Wednesday May 20, 2020 17:54:08 CEST
#
# @description : send a notification with charge level
######################################################################
notify() { \
for x in /sys/class/power_supply/BAT?/capacity;
do
case "$(cat "$x")" in
1[0-9]) notify-send -u "normal" "Battery is running low ($(cat "$x")%)" "Please plug your computer to a power source" ;;
[0-9]) notify-send -u "critical" "Battery is dangerously low ($(cat "$x")%)" "Please plug your computer to a power source - <b>NOW!</b>" ;;
esac
done
}
update() { \
# We want the notification to be sent every 5 mins
# But only if the computer is unplugged
if [ "$(cat /sys/class/power_supply/AC/online)" = 0 ]; then
notify && kill -36 $(pidof dwmblocks)
fi
wait
}
update

View File

@ -1,14 +0,0 @@
#!/usr/bin/env sh
######################################################################
# @author : swytch (adapted form Luke Smith - lukesmith.xyz)
# @file : refbar
# @license : MIT
# @created : Wednesday May 20, 2020 18:21:19 CEST
#
# @description : refresh dwmbar
######################################################################
# Send SIGTRAP signal to dwmbar script, which will handle it with a trap.
pkill -SIGTRAP dwmbar

View File

@ -13,6 +13,15 @@
# Will show all batteries with approximate icon for remaining power.
# Or show that the computer is plugged to a power source
# In any case, show the remaining battery percentage
# Also sends a notification if battery running low
notify() { \
case "$(cat "$x")" in
1[0-9]) notify-send -u "normal" "Battery is $status and running low ($capacity%)" "Please plug your computer to a power source" ;;
[0-9]) notify-send -u "critical" "Battery is $status and dangerously low ($capacity%)" "Please plug your computer to a power source - <b>NOW!</b>" ;;
esac
}
for bat in /sys/class/power_supply/BAT?/
do
status="$(cat "$bat/status")"