chore: mess with waybar for the laptop configuration

This commit is contained in:
Ahwx 2025-05-09 03:44:17 +02:00
parent b9e2e56206
commit 1f302adc0f
2 changed files with 480 additions and 395 deletions

View file

@ -178,6 +178,57 @@
echo -e "{\"text\":\""$text"\", \"class\":\""$class"\"}"
'';
};
"/home/${username}/.local/bin/waybar-devices" = {
executable = true;
text = ''
#!/usr/bin/env bash
if [[ $(cat /proc/acpi/button/lid/LID0/state | grep "open") ]]; then
LTEXT="󰌢 "
else
LTEXT="󰛧 "
fi
MICROPHONE_STATE="$(sudo /home/liv/.local/src/framework-system/target/debug/framework_tool --privacy | tail -n2 | head -n1)"
CAMERA_STATE="$(sudo /home/liv/.local/src/framework-system/target/debug/framework_tool --privacy | tail -n1)"
if [[ "$(echo $MICROPHONE_STATE | grep 'Microphone: Connected')" ]]; then
MIC=1
MTEXT="󰍬 - available!"
else
MIC=0
MTEXT=" "
fi
if [[ "$(echo $CAMERA_STATE | grep 'Camera: Connected')" ]]; then
CAM=1
CTEXT="󰄀 - available!"
else
CAM=0
CTEXT="󰗟 "
fi
echo "$LTEXT $CTEXT $MTEXT"
'';
};
"/home/${username}/.local/bin/waybar-powerdraw" = {
executable = true;
text = ''
#!/usr/bin/env zsh
if [[ "$(cat /sys/class/power_supply/BAT1/status)" == "Discharging" ]]; then; cat /sys/class/power_supply/BAT1/current_now /sys/class/power_supply/BAT1/voltage_now | xargs | awk '{print $1*$2/1e12 " W"}'; fi
'';
};
"/home/${username}/.local/bin/waybar-vpn" = {
executable = true;
text = ''
#!/usr/bin/env bash
ip route | grep -q '10.7.0.0' \
&& echo '{"text":"Connected","class":"connected","percentage":100}' \
|| echo '{"text":"Disconnected","class":"disconnected","percentage":0}'
'';
};
};
home.packages = with pkgs; [
wf-recorder