Added dwm scripts for battery-status and notification
This commit is contained in:
parent
46018fb461
commit
d5f72ee2fd
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
# Notification scripts
|
# Notification scripts
|
||||||
./scripts/dunstify-volume-notification.nix
|
./scripts/dunstify-volume-notification.nix
|
||||||
|
./scripts/dunstify-battery-notification.nix
|
||||||
|
|
||||||
# Helper scripts
|
# Helper scripts
|
||||||
./scripts/emoji-picker.nix
|
./scripts/emoji-picker.nix
|
||||||
|
@ -29,6 +30,7 @@
|
||||||
./scripts/git-commit-ai.nix
|
./scripts/git-commit-ai.nix
|
||||||
./scripts/aichat-wrapper.nix
|
./scripts/aichat-wrapper.nix
|
||||||
./scripts/dmenu-wifi.nix
|
./scripts/dmenu-wifi.nix
|
||||||
|
./scripts/battery-status.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
home.packages = [
|
home.packages = [
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
home.packages = [
|
||||||
|
(pkgs.writeShellScriptBin "battery-status" ''
|
||||||
|
status=$(${pkgs.acpi}/bin/acpi)
|
||||||
|
bat_name=$(echo "$status" | grep -o -e "^[Aa-Zz]*\s[0-9]:")
|
||||||
|
bat_status=$(echo $status | grep -o -e "[A-Z][a-z]*," | sed "s/,//")
|
||||||
|
bat_pct=$(echo $status | grep -o -e "[0-9]*%")
|
||||||
|
bat_time=$(echo $status | grep -o -e "[0-9]*:[0-9]*:[0-9]* [a-z].*")
|
||||||
|
power=$(cat /sys/class/power_supply/BAT0/power_now)
|
||||||
|
power_watts=$(${pkgs.bc}/bin/bc <<< "scale=3; $power / 1000000")
|
||||||
|
|
||||||
|
echo -e "$bat_name ($bat_status)\nCharge: $bat_pct\nTime: $bat_time\nPower consumption: $power_watts W "
|
||||||
|
'')
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
home.packages = [
|
||||||
|
(pkgs.writeShellScriptBin "dunstify-battery-notification" ''
|
||||||
|
msgTag="battery-notify"
|
||||||
|
${pkgs.dunst}/bin/dunstify -a "batteryNotify" -u critical -i battery-notify -h string:x-dunst-stack-tag:$msgTag "Battery Status" "$(battery-status)" -t 5000
|
||||||
|
'')
|
||||||
|
];
|
||||||
|
}
|
Loading…
Reference in New Issue