mirror of
https://github.com/GRFreire/scripts.git
synced 2026-01-09 04:49:38 +00:00
Compare commits
3 Commits
42f55f76dc
...
6de5431477
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6de5431477 | ||
|
|
dfe8069718 | ||
|
|
b33b678b3b |
1
bin/check_battery
Symbolic link
1
bin/check_battery
Symbolic link
@ -0,0 +1 @@
|
||||
../check_battery/check_battery.sh
|
||||
9
check_battery/README.md
Normal file
9
check_battery/README.md
Normal file
@ -0,0 +1,9 @@
|
||||
# check_battery
|
||||
|
||||
## About
|
||||
Check the battery percentage and notify user if it is about to end.
|
||||
|
||||
## Requirements
|
||||
- notify-send
|
||||
- mpv
|
||||
- UPower
|
||||
17
check_battery/check_battery.sh
Executable file
17
check_battery/check_battery.sh
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
DEVICE="/org/freedesktop/UPower/devices/battery_BAT0"
|
||||
|
||||
time="$(upower -i $DEVICE | grep time | cut -d':' -f2 | tr -s ' ' | cut -c2-)"
|
||||
perc="$(upower -i $DEVICE | grep percentage | awk '{print $2}' | tr -d '%')"
|
||||
stat="$(upower -i $DEVICE | grep state | awk '{print $2}')"
|
||||
|
||||
if [ "$perc" -le "20" ]; then
|
||||
urgency="normal"
|
||||
if [ "$perc" -le "10" ]; then
|
||||
urgency="critical"
|
||||
fi
|
||||
notify-send -u "$urgency" --icon="battery" "Battery is low ($perc%)" "Time remaining is $time."
|
||||
mpv /usr/share/sounds/freedesktop/stereo/dialog-information.oga
|
||||
fi
|
||||
|
||||
@ -5,11 +5,20 @@ id="$(xinput list | grep Touchpad | cut -f 2 | sed 's/id=//')"
|
||||
xinput disable "$id"
|
||||
xinput enable "$id"
|
||||
|
||||
# $1 prop name
|
||||
get_prop() {
|
||||
name="$1 ("
|
||||
xinput list-props "$id" | grep "$name" | sed 's/.*(\(.*\)):.*/\1/'
|
||||
}
|
||||
|
||||
# Set NaturalScrolling
|
||||
xinput set-prop "$id" 382 -93, -93
|
||||
prop="$(get_prop 'Synaptics Scrolling Distance')"
|
||||
xinput set-prop "$id" "$prop" -93, -93
|
||||
|
||||
# Set Tap to Click
|
||||
xinput set-prop "$id" 389 1, 1, 1, 2, 1, 3
|
||||
prop="$(get_prop 'Synaptics Tap Action')"
|
||||
xinput set-prop "$id" "$prop" 1, 1, 1, 2, 1, 3
|
||||
|
||||
# Enable Horizontal and Vertical Two-Finger scrolling
|
||||
xinput set-prop "$id" 384 1, 1
|
||||
prop="$(get_prop 'Synaptics Two-Finger Scrolling')"
|
||||
xinput set-prop "$id" "$prop" 1, 1
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "$(command -v rofi)" ]; then
|
||||
CMD='rofi -dmenu';
|
||||
CMD='rofi -dmenu -i';
|
||||
elif [ "$(command -v dmenu)" ]; then
|
||||
CMD='dmenu';
|
||||
else
|
||||
|
||||
Loading…
Reference in New Issue
Block a user