mirror of
https://github.com/Keyitdev/dotfiles.git
synced 2026-09-24 01:52:09 +00:00
Update: Added listeners, and more shortcuts to i3 config.
This commit is contained in:
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/bin/sh
|
||||
|
||||
# inotify-tools
|
||||
|
||||
# specify the path to the fan_boost_mode file
|
||||
fan_boost_mode_file="/sys/devices/platform/asus-nb-wmi/throttle_thermal_policy"
|
||||
|
||||
# variable to store the previous fan boost mode
|
||||
previous_mode=""
|
||||
|
||||
# kill previous instances
|
||||
for pid in $(pidof -x asus_fan_listener); do
|
||||
if [ "$pid" != $$ ]; then
|
||||
kill -9 "$pid"
|
||||
fi
|
||||
done
|
||||
|
||||
# function to get the label for a given mode
|
||||
get_mode_label() {
|
||||
case $1 in
|
||||
0) echo "Performance" ;;
|
||||
1) echo "Turbo" ;;
|
||||
2) echo "Silent" ;;
|
||||
*) echo "Unknown Mode" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# function to check and send a notification if the mode has changed
|
||||
check_and_send_notification() {
|
||||
current_mode=$(cat "$fan_boost_mode_file")
|
||||
current_label=$(get_mode_label "$current_mode")
|
||||
|
||||
if [ "$current_mode" != "$previous_mode" ]; then
|
||||
dunstify -a "Fan Mode" "Fan Mode" "$current_label" -r 100
|
||||
previous_mode="$current_mode"
|
||||
fi
|
||||
}
|
||||
|
||||
# monitor for changes in the fan_boost_mode file
|
||||
while inotifywait -e modify "$fan_boost_mode_file"; do
|
||||
check_and_send_notification
|
||||
done
|
||||
|
||||
# or run always
|
||||
# while true; do
|
||||
# check_and_send_notification
|
||||
# done
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
# 0 Performance
|
||||
# 1 Turbo
|
||||
# 2 Silent
|
||||
|
||||
fan_boost_mode_file="/sys/devices/platform/asus-nb-wmi/throttle_thermal_policy"
|
||||
current_mode=$(cat "$fan_boost_mode_file")
|
||||
|
||||
if [ "$current_mode" -eq 0 ]; then
|
||||
echo 1 | pkexec tee /sys/devices/platform/asus-nb-wmi/throttle_thermal_policy
|
||||
elif [ "$current_mode" -eq 1 ]; then
|
||||
echo 2 | pkexec tee /sys/devices/platform/asus-nb-wmi/throttle_thermal_policy
|
||||
elif [ "$current_mode" -eq 2 ]; then
|
||||
echo 0 | pkexec tee /sys/devices/platform/asus-nb-wmi/throttle_thermal_policy
|
||||
else
|
||||
echo 0 | pkexec tee /sys/devices/platform/asus-nb-wmi/throttle_thermal_policy
|
||||
fi
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
|
||||
# upower
|
||||
|
||||
# kill previous instances
|
||||
for pid in $(pidof -x battery); do
|
||||
if [ "$pid" != $$ ]; then
|
||||
kill -9 "$pid"
|
||||
fi
|
||||
done
|
||||
|
||||
dir_icons="/usr/local/bin/icons"
|
||||
|
||||
# notify when below this percentage
|
||||
warning_level=20
|
||||
|
||||
# how often to check battery status, in seconds
|
||||
check_interval=60
|
||||
|
||||
while true; do
|
||||
path_to_battery=$(upower -e | grep BAT)
|
||||
battery_level=$(upower -i "$path_to_battery" | grep -E "percentage" | sed 's/[^0-9]//g')
|
||||
discharging=$(upower -i "$path_to_battery" | grep -E "state" | grep -c "discharging")
|
||||
time_to_empty=$(upower -i "$path_to_battery" | grep -E "time to empty" | sed 's/.*: *//')
|
||||
|
||||
# check if battery is low and discharging
|
||||
if [ "$battery_level" -lt "$warning_level" ] && [ "$discharging" -eq 1 ]
|
||||
then
|
||||
dunstify -a "Battery" \
|
||||
"Low battery: ${battery_level}%" \
|
||||
"Battery is low ($time_to_empty left)" \
|
||||
-r 100 \
|
||||
-i $dir_icons/battery.svg
|
||||
fi
|
||||
|
||||
sleep ${check_interval}s
|
||||
done
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
touchad_id=$(xinput list | grep -i 'touchpad' | grep -oP 'id=\K\d+')
|
||||
|
||||
@@ -9,7 +9,6 @@ fi
|
||||
|
||||
state=$(xinput list-props "$touchad_id" | grep "Device Enabled" | grep -o "[01]$")
|
||||
|
||||
# Przełącz stan touchpada
|
||||
if [ "$state" -eq 1 ]; then
|
||||
xinput disable "$touchad_id"
|
||||
dunstify -a "Touchpad" "Touchpad" "Touchpad is disabled" -r 100
|
||||
|
||||
Reference in New Issue
Block a user