-
Notifications
You must be signed in to change notification settings - Fork 0
/
xinitrc
35 lines (29 loc) · 825 Bytes
/
xinitrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh
# map caps to backspace
xsetkbmap -option caps:backspace
# setting statusbar, very clunky
while xsetroot -name " \
`date +\"%A %B %d %H:%M\"` | \
BAT:`acpi | awk '/Charging/ {print \"+\"$4} /Discharging/ {print $4} /Not charging/ {print \"+\"$5}'` \
CPU:`uptime | sed -e 's/.*ge: //g' -e 's/, .*//g' -e 's/\.//g'`%\
"
do
sleep 10
done &
# battery check script
battery_level=`acpi | grep -oP '(?<=, )\d+(?=%)'`
if [ "$battery_level" -le 15 ]
then
notify-send "Battery low. Battery level is ${battery_level}%!"
elif [ "$battery_level" -le 3 ]
then
notify-send "Battery critical. Battery level is ${battery_level}%! Suspending..."
sleep 5
systemctl suspend
fi
# backgrounds and stuff
[ -f ~/.config/xprofile ] && . ~/.config/xprofile
# notification daemon
dunst &
# message bus daemon
exec dbus-launch dwm