Compare commits

...

2 Commits

Author SHA1 Message Date
Sam d5f72ee2fd Added dwm scripts for battery-status and notification 2024-07-21 01:03:28 +01:00
Sam 46018fb461 Removed unnecessary sxhkdrc keybindings 2024-07-21 01:02:48 +01:00
4 changed files with 27 additions and 12 deletions

View File

@ -20,6 +20,7 @@
# Notification scripts
./scripts/dunstify-volume-notification.nix
./scripts/dunstify-battery-notification.nix
# Helper scripts
./scripts/emoji-picker.nix
@ -29,6 +30,7 @@
./scripts/git-commit-ai.nix
./scripts/aichat-wrapper.nix
./scripts/dmenu-wifi.nix
./scripts/battery-status.nix
];
home.packages = [

View File

@ -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 "
'')
];
}

View File

@ -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
'')
];
}

View File

@ -15,21 +15,9 @@
XF86AudioMicMute
pamixer --default-source --toggle-mute && dunstify-volume-notification && pkill -RTMIN+10 dwmblocks && exit 1
XF86MonBrightnessUp
light -A 5 && dunstify-brightness-notification
XF86MonBrightnessDown
light -U 5 && dunstify-brightness-notification
XF86Messenger
dunstify-battery-notification
control + Home
bookmark-add
control + Insert
bookmark-insert
control + F8
clipboard-image-recall /tmp/clipboard/images/