From 09b12698892be31755360d0b45427410f8ae67ba Mon Sep 17 00:00:00 2001 From: Aargh Rai Date: Wed, 17 Sep 2025 15:24:11 +0530 Subject: simplified waybar --- hypr/battery-notif.sh | 1 + hypr/battery_warning.py | 18 ++++++++++++++++++ hypr/hyprland.conf | 1 + waybar/config | 37 ++++++++++++++++++++----------------- 4 files changed, 40 insertions(+), 17 deletions(-) create mode 100644 hypr/battery-notif.sh create mode 100644 hypr/battery_warning.py diff --git a/hypr/battery-notif.sh b/hypr/battery-notif.sh new file mode 100644 index 0000000..d08b1d0 --- /dev/null +++ b/hypr/battery-notif.sh @@ -0,0 +1 @@ +python battery_warning.py diff --git a/hypr/battery_warning.py b/hypr/battery_warning.py new file mode 100644 index 0000000..882e8dd --- /dev/null +++ b/hypr/battery_warning.py @@ -0,0 +1,18 @@ +import psutil +import subprocess +import time + +WARNING_LEVEL = 30 +CRITICAL_LEVEL = 15 + +while True: + battery = psutil.sensors_battery() + percent = battery.percent + if battery.power_plugged: + pass # Optionally notify full + else: + if percent <= CRITICAL_LEVEL: + subprocess.run(['notify-send', '-u', 'critical', 'Very Low Battery', '-i', '/home/aargh/.config/waybar/battery_low.png']) + elif percent <= WARNING_LEVEL: + subprocess.run(['notify-send', '-u', 'normal', 'Low Battery', '-i', '/home/aargh/.config/waybar/battery_low.png']) + time.sleep(5) diff --git a/hypr/hyprland.conf b/hypr/hyprland.conf index b106b07..7acea64 100644 --- a/hypr/hyprland.conf +++ b/hypr/hyprland.conf @@ -8,6 +8,7 @@ $fileManager = foot -e yazi $menu = wofi --show drun exec-once = ~/.config/hypr/random-wall.sh # random wallpaper +exec-once = ~/.config/hypr/battery-notif.sh # low battery notification exec-once = wl-paste --watch cliphist store # clipboard exec-once = mako # notification exec-once = waybar # top bar diff --git a/waybar/config b/waybar/config index 46cef16..5965d0e 100644 --- a/waybar/config +++ b/waybar/config @@ -13,6 +13,8 @@ "custom/space", "pulseaudio", "custom/space", + "custom/brightness", + "custom/space", "custom/temperature", "custom/space", "memory", @@ -35,33 +37,28 @@ "format": " ", }, "network": { - "format-wifi": "Signal(Wifi):{essid}", - "format-ethernet": "Signal(Ethernet)", - "format-linked": "Signal(Linked){ifname}", - "format-disconnected": "Signal:Offline", + "format-wifi": "Radio(Wifi):{essid}", + "format-ethernet": "Radio(Ethernet)", + "format-linked": "Radio(Linked){ifname}", + "format-disconnected": "Radio:Offline", "interval": 1, "on-click": "foot -e nmtui", "tooltip-format": "Sending: {bandwidthUpBytes} Receiving: {bandwidthDownBytes}", }, "battery": { + "interval": 1, "states": { "warning": 30, "critical": 15 }, - "events": { - "on-discharging-warning": "notify-send -u normal 'Low Battery' -i /home/aargh/.config/waybar/battery_low.png", - "on-discharging-critical": "notify-send -u critical 'Very Low Battery' -i /home/aargh/.config/waybar/battery_low.png", - "on-charging-100": "notify-send -u normal 'Battery Full!' -i /home/aargh/.config/waybar/battery_high.png" - }, - "format": "Battery:{capacity}%", - "format-charging": "AC/DC:{capacity}%", - "interval": 1, + "format": "Electron:{capacity}%", + "format-charging": "Electron:AC/DC({capacity}%)", "format-icons": ["󰂎", "󰁼", "󰁿", "󰂁", "󰁹"], "tooltip": true }, "pulseaudio": { - "format": "Sound:{volume}%", - "format-muted": "Sound:off", + "format": "Waves:{volume}%", + "format-muted": "Waves:off", "format-icons": { "headphone": "", "hands-free": "", @@ -79,18 +76,24 @@ "on-click": "pactl -- set-sink-mute 0 toggle", "tooltip": false, }, + "custom/brightness": { + "exec": "brightnessctl | grep 'Current brightness' | grep -o '[0-9]\\+' | head -n 1", + "format": "Photons:{}", + "interval": 1, + "tooltip": false, + }, "custom/temperature": { "exec": "sensors | awk '/^Package id 0:/ {print int($4) + 273}'", - "format": "Heat:{}K", + "format": "Radiation:{}K", "interval": 5, "tooltip": false, }, "memory": { - "format": "RAM({total}G):{used}G", + "format": "Latch:{used}G", "tooltip": false, }, "cpu": { - "format": "CPU:{avg_frequency}Hz", + "format": "Data Bus:{avg_frequency}Hz", "tooltip": true, }, "clock": { -- cgit v1.2.3