21 lines
594 B
Bash
Executable File
21 lines
594 B
Bash
Executable File
#!/usr/bin/env bash
|
|
ctlcmd=$1
|
|
format_time() {
|
|
local total_seconds=$1
|
|
local hours=$((total_seconds / 3600))
|
|
local minutes=$(( (total_seconds % 3600) / 60 ))
|
|
local seconds=$((total_seconds % 60))
|
|
printf "%02d:%02d:%02d\n" $hours $minutes $seconds
|
|
}
|
|
start_time=$(date +%s)
|
|
if [ -z $ctlcmd ]; then
|
|
swaylock
|
|
else
|
|
systemctl $ctlcmd & swaylock
|
|
fi
|
|
current_time=$(date +%s)
|
|
elapsed_time=$((current_time - start_time))
|
|
formatted_time=$(format_time $elapsed_time)
|
|
dunstify -a "System" "Power Managment" "You have left ${formatted_time} ago."
|
|
openrgb -p $HOME/.config/OpenRGB/Cat.orp
|