Compare commits

..

4 Commits

Author SHA1 Message Date
3c91c43fdf Add example crontab file 2023-12-26 13:50:02 +03:00
e030b16b8f Add battery script 2023-12-26 13:47:56 +03:00
328b1eb452 Update zsh submodule 2023-12-26 11:50:08 +03:00
c0861925f2 Update .zshenv 2023-12-26 11:46:35 +03:00
5 changed files with 43 additions and 4 deletions

19
.config/crontab Normal file
View File

@ -0,0 +1,19 @@
# DISPLAY=:0
XDG_RUNTIME_DIR=/run/user/1000
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR Jan-Dec
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR SUN-SAT
# | | | | |
# * * * * * user-name command to be executed
# * any value
# , value list separator
# - range of values
# / step values
* * * * * /home/sahin/scripts/check-battery.sh 10

@ -1 +1 @@
Subproject commit 7f999024a5bbfaf0bdf7a4e493a3658db5b97ee2 Subproject commit 20dfe30e960d98db2c259a355ecef96f43ca6021

2
.gitmodules vendored
View File

@ -12,5 +12,5 @@
branch = linux branch = linux
[submodule ".config/zsh"] [submodule ".config/zsh"]
path = .config/zsh path = .config/zsh
url = https://github.com/sahinakkaya/zsh.git url = https://github.com/sahinakkaya/zsh-config.git
branch = linux branch = linux

View File

@ -1,3 +1,3 @@
export ZDOTDIR="$HOME/.config/zsh" export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:=$HOME/.config}"
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}" export ZDOTDIR="${ZDOTDIR:=$XDG_CONFIG_HOME/zsh}"
export PATH="$HOME/scripts/:$HOME/.local/bin/:$PATH" export PATH="$HOME/scripts/:$HOME/.local/bin/:$PATH"

20
scripts/check-battery.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
# Set limit to shell argument
batteryLimit=$1
fullAt=92
# Get the current battery level with acpi
batteryLevel=$(acpi | cut -d ' ' -f 4 | tr -d '%|,| ')
charging=$(acpi | cut -d ' ' -f 3 | tr -d ',| ')
echo $batteryLevel
if [[ "$batteryLevel" -le "$batteryLimit" ]] && [[ "$charging" == "Discharging" ]]; then
/usr/bin/notify-send -a "Battery Warning" --urgency critical "Battery level at ${batteryLevel}%" -i abrt -t 10000
/usr/bin/mpv /usr/share/sounds/Oxygen-Sys-Warning.ogg
# /usr/bin/aplay /usr/share/sounds/freedesktop/stereo/dialog-warning.oga
#elif [[ "$batteryLevel" -gt "$fullAt" ]] && [[ ! "$charging" == "Discharging" ]]; then
# /usr/bin/notify-send -a "Battery Warning" "Battery is full: ${batteryLevel}" -i abrt -t 10000
# /usr/bin/paplay /usr/share/sounds/freedesktop/stereo/dialog-warning.oga
fi